@daeryun/dr_components 0.1.22 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CountingSection/CountingSection.d.ts +9 -0
- package/dist/components/CountingSection/CountingSection.jsx +89 -0
- package/dist/components/CountingSection/CountingSection.stories.d.ts +8 -0
- package/dist/components/CountingSection/CountingSection.stories.jsx +47 -0
- package/dist/components/CountingSection/CountingSection.stories.tsx +55 -0
- package/dist/components/CountingSection/CountingSection.tsx +139 -0
- package/dist/components/common/data/index.d.ts +25 -0
- package/dist/components/common/data/index.js +1994 -0
- package/dist/components/common/data/index.ts +1999 -0
- package/dist/components/common/hook/index.d.ts +2 -0
- package/dist/components/common/hook/index.js +2 -0
- package/dist/components/common/hook/index.ts +2 -0
- package/dist/components/common/hook/useCountNum.d.ts +4 -0
- package/dist/components/common/hook/useCountNum.jsx +23 -0
- package/dist/components/common/hook/useCountNum.tsx +28 -0
- package/dist/components/common/index.d.ts +3 -25
- package/dist/components/common/index.js +3 -1994
- package/dist/components/common/index.ts +3 -1999
- package/dist/components/common/types/index.d.ts +5 -0
- package/dist/components/common/types/index.ts +19 -14
- package/dist/styles/font_style.css +238 -0
- package/dist/styles/globals.css +146 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IInitialDataTypes } from '../common';
|
|
3
|
+
declare const CountingSection: (props: {
|
|
4
|
+
initialData: IInitialDataTypes;
|
|
5
|
+
bgUrl?: string;
|
|
6
|
+
bgAlt?: string;
|
|
7
|
+
fontColor?: string;
|
|
8
|
+
}) => React.JSX.Element;
|
|
9
|
+
export default CountingSection;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
+
import Image from 'next/image';
|
|
3
|
+
import useCountNum from '../common/hook/useCountNum';
|
|
4
|
+
const CountingSection = (props) => {
|
|
5
|
+
const { initialData } = props;
|
|
6
|
+
const targetRef = useRef(null);
|
|
7
|
+
const [isCountMount, setIsCountMount] = useState(false);
|
|
8
|
+
const numClass = ' text-[50px] max-xl:text-[48px] max-lg:text-[42px] max-md:text-[38px] max-sm:text-[52px] max-2sm:text-[40px] max-xs:text-[30px] max-3xs:text-[32px] font-extrabold ';
|
|
9
|
+
const sectionRefs = [
|
|
10
|
+
useRef(null),
|
|
11
|
+
useRef(null),
|
|
12
|
+
useRef(null),
|
|
13
|
+
useRef(null)
|
|
14
|
+
];
|
|
15
|
+
const { count: consultationCount } = useCountNum(initialData.consult_cnt, 0, isCountMount, -16.5);
|
|
16
|
+
const { count: caseOutcomeCount } = useCountNum(initialData.success_2024, 0, isCountMount, -16.5);
|
|
17
|
+
const { count: professionalCount } = useCountNum(initialData.professional_cnt, 0, isCountMount);
|
|
18
|
+
const { count: nationwideOfficeCount } = useCountNum(initialData.office_cnt, 0, isCountMount);
|
|
19
|
+
//애니메이션
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const options = {
|
|
22
|
+
threshold: [0.1, 0.6, 0.65, 0.7, 0.75]
|
|
23
|
+
};
|
|
24
|
+
const callback = (entries, observer) => {
|
|
25
|
+
entries.forEach((entry, index) => {
|
|
26
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
27
|
+
if (entry.isIntersecting) {
|
|
28
|
+
if (entry.intersectionRatio >= 0.75) {
|
|
29
|
+
(_a = sectionRefs[3].current) === null || _a === void 0 ? void 0 : _a.classList.remove('opacity-0');
|
|
30
|
+
(_b = sectionRefs[3].current) === null || _b === void 0 ? void 0 : _b.classList.add(`animate-[fadeInUp_1.6s]`);
|
|
31
|
+
}
|
|
32
|
+
if (entry.intersectionRatio >= 0.7) {
|
|
33
|
+
(_c = sectionRefs[2].current) === null || _c === void 0 ? void 0 : _c.classList.remove('opacity-0');
|
|
34
|
+
(_d = sectionRefs[2].current) === null || _d === void 0 ? void 0 : _d.classList.add(`animate-[fadeInUp_1.4s]`);
|
|
35
|
+
}
|
|
36
|
+
if (entry.intersectionRatio >= 0.65) {
|
|
37
|
+
(_e = sectionRefs[1].current) === null || _e === void 0 ? void 0 : _e.classList.remove('opacity-0');
|
|
38
|
+
(_f = sectionRefs[1].current) === null || _f === void 0 ? void 0 : _f.classList.add(`animate-[fadeInUp_1.2s]`);
|
|
39
|
+
}
|
|
40
|
+
if (entry.intersectionRatio >= 0.6) {
|
|
41
|
+
(_g = sectionRefs[0].current) === null || _g === void 0 ? void 0 : _g.classList.remove('opacity-0');
|
|
42
|
+
(_h = sectionRefs[0].current) === null || _h === void 0 ? void 0 : _h.classList.add(`animate-[fadeInUp_1s]`);
|
|
43
|
+
setIsCountMount(true);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
const observer = new IntersectionObserver(callback, options);
|
|
49
|
+
if (targetRef.current) {
|
|
50
|
+
observer.observe(targetRef.current);
|
|
51
|
+
}
|
|
52
|
+
return () => {
|
|
53
|
+
if (targetRef.current) {
|
|
54
|
+
observer.unobserve(targetRef.current);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}, []);
|
|
58
|
+
return (<section ref={targetRef} className={'relative flex h-[460px] w-full items-center justify-center bg-[#F2F2F2] max-lg:h-[300px] max-sm:h-full max-sm:py-20 max-xs:py-16'}>
|
|
59
|
+
{props.bgUrl ? (<Image draggable={false} src={props.bgUrl} alt={props.bgAlt ? props.bgAlt : ''} fill/>) : (<></>)}
|
|
60
|
+
|
|
61
|
+
<div className={'relative z-10 grid h-[110px] w-[90%] max-w-[1340px] grid-cols-3 text-center leading-tight ' +
|
|
62
|
+
'max-lg:h-[90px] max-lg:w-full ' +
|
|
63
|
+
'max-sm:mt-6 max-sm:h-full sm:grid sm:grid-cols-3'} style={{ color: props.fontColor ? props.fontColor : 'black' }}>
|
|
64
|
+
<div ref={sectionRefs[1]} className={'flex flex-col justify-between opacity-0 '}>
|
|
65
|
+
<p className={'text-[24px] leading-none max-xl:text-[22px] max-lg:text-[18px] max-md:text-[16px] max-sm:text-[24px] max-xs:text-[20px] max-3xs:text-[18px]'}>
|
|
66
|
+
업무사례 <br />
|
|
67
|
+
<span className={'mt-1 text-[13px]'}>*2024년 상반기 기준</span>
|
|
68
|
+
</p>
|
|
69
|
+
|
|
70
|
+
<p className={numClass}>{caseOutcomeCount.toLocaleString()}</p>
|
|
71
|
+
</div>
|
|
72
|
+
<div style={{ borderColor: props.fontColor ? props.fontColor : 'black' }} ref={sectionRefs[2]} className={'flex flex-col justify-between border-x-[0.05vw] border-solid opacity-0'}>
|
|
73
|
+
<p className={'text-[24px] max-xl:text-[22px] max-lg:text-[18px] max-md:text-[16px] max-sm:text-[24px] max-xs:text-[20px] max-3xs:text-[18px]'}>
|
|
74
|
+
전문가
|
|
75
|
+
</p>
|
|
76
|
+
|
|
77
|
+
<p className={numClass}>{professionalCount} +</p>
|
|
78
|
+
</div>
|
|
79
|
+
<div ref={sectionRefs[3]} className={'flex flex-col justify-between opacity-0'}>
|
|
80
|
+
<p className={'text-[24px] max-xl:text-[22px] max-lg:text-[18px] max-md:text-[16px] max-sm:text-[24px] max-xs:text-[20px] max-3xs:text-[18px]'}>
|
|
81
|
+
전국대응거점
|
|
82
|
+
</p>
|
|
83
|
+
|
|
84
|
+
<p className={numClass}>{nationwideOfficeCount}</p>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
</section>);
|
|
88
|
+
};
|
|
89
|
+
export default CountingSection;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import CountingSection from './CountingSection';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import '../../styles/globals.css';
|
|
4
|
+
import '../../styles/font_style.css';
|
|
5
|
+
declare const meta: Meta<typeof CountingSection>;
|
|
6
|
+
export default meta;
|
|
7
|
+
type Story = StoryObj<typeof meta>;
|
|
8
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import CountingSection from './CountingSection';
|
|
2
|
+
import '../../styles/globals.css';
|
|
3
|
+
import '../../styles/font_style.css';
|
|
4
|
+
const meta = {
|
|
5
|
+
component: CountingSection,
|
|
6
|
+
title: 'CountingSection'
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
export const Default = {
|
|
10
|
+
render: args => {
|
|
11
|
+
return (<div className={'font-[SUIT]'}>
|
|
12
|
+
<CountingSection {...args}/>
|
|
13
|
+
</div>);
|
|
14
|
+
},
|
|
15
|
+
args: {
|
|
16
|
+
fontColor: 'pink',
|
|
17
|
+
bgUrl: 'https://d1tgonli21s4df.cloudfront.net/main_new/s8_bg.webp',
|
|
18
|
+
bgAlt: '배경',
|
|
19
|
+
initialData: {
|
|
20
|
+
lawyer_cnt: 200,
|
|
21
|
+
office_cnt: 39,
|
|
22
|
+
consult_cnt: 361053,
|
|
23
|
+
success_cnt: 19230,
|
|
24
|
+
center_cnt: 22,
|
|
25
|
+
regenerTotal_cnt: 7526723016,
|
|
26
|
+
professional_cnt: 550,
|
|
27
|
+
weekday: '06:00 ~ 24:00',
|
|
28
|
+
weekend: '06:00 ~ 24:00',
|
|
29
|
+
consult_time: '365일 24시간 상담과 긴급대응 가능',
|
|
30
|
+
success_2024: 19230,
|
|
31
|
+
field_center: [
|
|
32
|
+
'CT0001',
|
|
33
|
+
'CT0002',
|
|
34
|
+
'CT0005',
|
|
35
|
+
'CT0006',
|
|
36
|
+
'CT0012',
|
|
37
|
+
'CT0013',
|
|
38
|
+
'CT0015',
|
|
39
|
+
'CT0016',
|
|
40
|
+
'CT0018',
|
|
41
|
+
'CT0019',
|
|
42
|
+
'CT0024',
|
|
43
|
+
'CT0025'
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import CountingSection from './CountingSection';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import '../../styles/globals.css';
|
|
4
|
+
import '../../styles/font_style.css';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof CountingSection> = {
|
|
7
|
+
component: CountingSection,
|
|
8
|
+
title: 'CountingSection'
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof meta>;
|
|
14
|
+
|
|
15
|
+
export const Default: Story = {
|
|
16
|
+
render: args => {
|
|
17
|
+
return (
|
|
18
|
+
<div className={'font-[SUIT]'}>
|
|
19
|
+
<CountingSection {...args} />
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
},
|
|
23
|
+
args: {
|
|
24
|
+
fontColor: 'pink',
|
|
25
|
+
bgUrl: 'https://d1tgonli21s4df.cloudfront.net/main_new/s8_bg.webp',
|
|
26
|
+
bgAlt: '배경',
|
|
27
|
+
initialData: {
|
|
28
|
+
lawyer_cnt: 200,
|
|
29
|
+
office_cnt: 39,
|
|
30
|
+
consult_cnt: 361053,
|
|
31
|
+
success_cnt: 19230,
|
|
32
|
+
center_cnt: 22,
|
|
33
|
+
regenerTotal_cnt: 7526723016,
|
|
34
|
+
professional_cnt: 550,
|
|
35
|
+
weekday: '06:00 ~ 24:00',
|
|
36
|
+
weekend: '06:00 ~ 24:00',
|
|
37
|
+
consult_time: '365일 24시간 상담과 긴급대응 가능',
|
|
38
|
+
success_2024: 19230,
|
|
39
|
+
field_center: [
|
|
40
|
+
'CT0001',
|
|
41
|
+
'CT0002',
|
|
42
|
+
'CT0005',
|
|
43
|
+
'CT0006',
|
|
44
|
+
'CT0012',
|
|
45
|
+
'CT0013',
|
|
46
|
+
'CT0015',
|
|
47
|
+
'CT0016',
|
|
48
|
+
'CT0018',
|
|
49
|
+
'CT0019',
|
|
50
|
+
'CT0024',
|
|
51
|
+
'CT0025'
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
+
import Image from 'next/image';
|
|
3
|
+
import { IInitialDataTypes } from '../common';
|
|
4
|
+
import useCountNum from '../common/hook/useCountNum';
|
|
5
|
+
|
|
6
|
+
const CountingSection = (props: {
|
|
7
|
+
initialData: IInitialDataTypes;
|
|
8
|
+
bgUrl?: string;
|
|
9
|
+
bgAlt?: string;
|
|
10
|
+
fontColor?: string;
|
|
11
|
+
}) => {
|
|
12
|
+
const { initialData } = props;
|
|
13
|
+
|
|
14
|
+
const targetRef = useRef<HTMLDivElement>(null);
|
|
15
|
+
const [isCountMount, setIsCountMount] = useState(false);
|
|
16
|
+
|
|
17
|
+
const numClass =
|
|
18
|
+
' text-[50px] max-xl:text-[48px] max-lg:text-[42px] max-md:text-[38px] max-sm:text-[52px] max-2sm:text-[40px] max-xs:text-[30px] max-3xs:text-[32px] font-extrabold ';
|
|
19
|
+
|
|
20
|
+
const sectionRefs = [
|
|
21
|
+
useRef<HTMLDivElement>(null),
|
|
22
|
+
useRef<HTMLDivElement>(null),
|
|
23
|
+
useRef<HTMLDivElement>(null),
|
|
24
|
+
useRef<HTMLDivElement>(null)
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
const { count: consultationCount } = useCountNum(initialData.consult_cnt, 0, isCountMount, -16.5);
|
|
28
|
+
const { count: caseOutcomeCount } = useCountNum(initialData.success_2024, 0, isCountMount, -16.5);
|
|
29
|
+
const { count: professionalCount } = useCountNum(initialData.professional_cnt, 0, isCountMount);
|
|
30
|
+
const { count: nationwideOfficeCount } = useCountNum(initialData.office_cnt, 0, isCountMount);
|
|
31
|
+
|
|
32
|
+
//애니메이션
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const options: IntersectionObserverInit = {
|
|
35
|
+
threshold: [0.1, 0.6, 0.65, 0.7, 0.75]
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const callback: IntersectionObserverCallback = (entries, observer) => {
|
|
39
|
+
entries.forEach((entry, index) => {
|
|
40
|
+
if (entry.isIntersecting) {
|
|
41
|
+
if (entry.intersectionRatio >= 0.75) {
|
|
42
|
+
sectionRefs[3].current?.classList.remove('opacity-0');
|
|
43
|
+
sectionRefs[3].current?.classList.add(`animate-[fadeInUp_1.6s]`);
|
|
44
|
+
}
|
|
45
|
+
if (entry.intersectionRatio >= 0.7) {
|
|
46
|
+
sectionRefs[2].current?.classList.remove('opacity-0');
|
|
47
|
+
sectionRefs[2].current?.classList.add(`animate-[fadeInUp_1.4s]`);
|
|
48
|
+
}
|
|
49
|
+
if (entry.intersectionRatio >= 0.65) {
|
|
50
|
+
sectionRefs[1].current?.classList.remove('opacity-0');
|
|
51
|
+
sectionRefs[1].current?.classList.add(`animate-[fadeInUp_1.2s]`);
|
|
52
|
+
}
|
|
53
|
+
if (entry.intersectionRatio >= 0.6) {
|
|
54
|
+
sectionRefs[0].current?.classList.remove('opacity-0');
|
|
55
|
+
sectionRefs[0].current?.classList.add(`animate-[fadeInUp_1s]`);
|
|
56
|
+
setIsCountMount(true);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const observer = new IntersectionObserver(callback, options);
|
|
63
|
+
|
|
64
|
+
if (targetRef.current) {
|
|
65
|
+
observer.observe(targetRef.current);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return () => {
|
|
69
|
+
if (targetRef.current) {
|
|
70
|
+
observer.unobserve(targetRef.current);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}, []);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<section
|
|
77
|
+
ref={targetRef}
|
|
78
|
+
className={
|
|
79
|
+
'relative flex h-[460px] w-full items-center justify-center bg-[#F2F2F2] max-lg:h-[300px] max-sm:h-full max-sm:py-20 max-xs:py-16'
|
|
80
|
+
}
|
|
81
|
+
>
|
|
82
|
+
{props.bgUrl ? (
|
|
83
|
+
<Image draggable={false} src={props.bgUrl} alt={props.bgAlt ? props.bgAlt : ''} fill />
|
|
84
|
+
) : (
|
|
85
|
+
<></>
|
|
86
|
+
)}
|
|
87
|
+
|
|
88
|
+
<div
|
|
89
|
+
className={
|
|
90
|
+
'relative z-10 grid h-[110px] w-[90%] max-w-[1340px] grid-cols-3 text-center leading-tight ' +
|
|
91
|
+
'max-lg:h-[90px] max-lg:w-full ' +
|
|
92
|
+
'max-sm:mt-6 max-sm:h-full sm:grid sm:grid-cols-3'
|
|
93
|
+
}
|
|
94
|
+
style={{ color: props.fontColor ? props.fontColor : 'black' }}
|
|
95
|
+
>
|
|
96
|
+
<div ref={sectionRefs[1]} className={'flex flex-col justify-between opacity-0 '}>
|
|
97
|
+
<p
|
|
98
|
+
className={
|
|
99
|
+
'text-[24px] leading-none max-xl:text-[22px] max-lg:text-[18px] max-md:text-[16px] max-sm:text-[24px] max-xs:text-[20px] max-3xs:text-[18px]'
|
|
100
|
+
}
|
|
101
|
+
>
|
|
102
|
+
업무사례 <br />
|
|
103
|
+
<span className={'mt-1 text-[13px]'}>*2024년 상반기 기준</span>
|
|
104
|
+
</p>
|
|
105
|
+
|
|
106
|
+
<p className={numClass}>{caseOutcomeCount.toLocaleString()}</p>
|
|
107
|
+
</div>
|
|
108
|
+
<div
|
|
109
|
+
style={{ borderColor: props.fontColor ? props.fontColor : 'black' }}
|
|
110
|
+
ref={sectionRefs[2]}
|
|
111
|
+
className={'flex flex-col justify-between border-x-[0.05vw] border-solid opacity-0'}
|
|
112
|
+
>
|
|
113
|
+
<p
|
|
114
|
+
className={
|
|
115
|
+
'text-[24px] max-xl:text-[22px] max-lg:text-[18px] max-md:text-[16px] max-sm:text-[24px] max-xs:text-[20px] max-3xs:text-[18px]'
|
|
116
|
+
}
|
|
117
|
+
>
|
|
118
|
+
전문가
|
|
119
|
+
</p>
|
|
120
|
+
|
|
121
|
+
<p className={numClass}>{professionalCount} +</p>
|
|
122
|
+
</div>
|
|
123
|
+
<div ref={sectionRefs[3]} className={'flex flex-col justify-between opacity-0'}>
|
|
124
|
+
<p
|
|
125
|
+
className={
|
|
126
|
+
'text-[24px] max-xl:text-[22px] max-lg:text-[18px] max-md:text-[16px] max-sm:text-[24px] max-xs:text-[20px] max-3xs:text-[18px]'
|
|
127
|
+
}
|
|
128
|
+
>
|
|
129
|
+
전국대응거점
|
|
130
|
+
</p>
|
|
131
|
+
|
|
132
|
+
<p className={numClass}>{nationwideOfficeCount}</p>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
</section>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export default CountingSection;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface IMapArea {
|
|
2
|
+
[region: string]: Array<{
|
|
3
|
+
name: string;
|
|
4
|
+
desc: string;
|
|
5
|
+
url: string;
|
|
6
|
+
src: string;
|
|
7
|
+
}>;
|
|
8
|
+
}
|
|
9
|
+
export declare const newNapAreaMobile: IMapArea;
|
|
10
|
+
export declare const centerListExample: ({
|
|
11
|
+
code: string;
|
|
12
|
+
code_name: string;
|
|
13
|
+
code_desc: string;
|
|
14
|
+
isSelect: boolean;
|
|
15
|
+
} | {
|
|
16
|
+
code: string;
|
|
17
|
+
code_name: string;
|
|
18
|
+
code_desc: string;
|
|
19
|
+
isSelect?: undefined;
|
|
20
|
+
})[];
|
|
21
|
+
export declare const categoryListExample: {
|
|
22
|
+
idx: number;
|
|
23
|
+
center_code: string;
|
|
24
|
+
title: string;
|
|
25
|
+
}[];
|