@daeryun/dr_components 0.1.92 → 0.1.93
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/asset/images/header/logo_b.webp +0 -0
- package/dist/asset/images/header/logo_w.webp +0 -0
- package/dist/asset/images/header/military.svg +38 -0
- package/dist/asset/images/header/military_w.svg +38 -0
- package/dist/components/Header/Header.d.ts +4 -0
- package/dist/components/Header/Header.jsx +189 -0
- package/dist/components/Header/Header.stories.d.ts +8 -0
- package/dist/components/Header/Header.stories.jsx +200 -0
- package/dist/components/Header/Header.stories.tsx +209 -0
- package/dist/components/Header/Header.tsx +280 -0
- package/dist/components/Header/Menu.d.ts +4 -0
- package/dist/components/Header/Menu.jsx +10 -0
- package/dist/components/Header/Menu.tsx +29 -0
- package/dist/components/Header/MobileMenu.d.ts +4 -0
- package/dist/components/Header/MobileMenu.jsx +209 -0
- package/dist/components/Header/MobileMenu.tsx +370 -0
- package/dist/components/Header/PCMenu.d.ts +4 -0
- package/dist/components/Header/PCMenu.jsx +130 -0
- package/dist/components/Header/PCMenu.tsx +243 -0
- package/dist/components/Header/main.module.css +150 -0
- package/dist/components/MapFix/AreaImage.jsx +10 -9
- package/dist/components/MapFix/AreaImage.tsx +21 -26
- package/dist/components/MapSection/MapSection.stories.jsx +16 -0
- package/dist/components/MapSection/MapSection.stories.tsx +34 -0
- package/dist/components/hook/useBrowser.d.ts +5 -0
- package/dist/components/hook/useBrowser.js +51 -0
- package/dist/components/hook/useBrowser.ts +58 -0
- package/dist/components/hook/useCountNum.d.ts +4 -0
- package/dist/components/hook/useCountNum.jsx +23 -0
- package/dist/components/hook/useCountNum.tsx +28 -0
- package/dist/components/hook/useElementObserve.d.ts +7 -0
- package/dist/components/hook/useElementObserve.js +39 -0
- package/dist/components/hook/useElementObserve.ts +46 -0
- package/dist/components/hook/useScrollRestoration.d.ts +5 -0
- package/dist/components/hook/useScrollRestoration.js +61 -0
- package/dist/components/hook/useScrollRestoration.ts +80 -0
- package/dist/components/hook/useScrollRestorationException.d.ts +2 -0
- package/dist/components/hook/useScrollRestorationException.js +24 -0
- package/dist/components/hook/useScrollRestorationException.ts +30 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index.ts +1 -0
- package/dist/components/myCase/MyCase.d.ts +5 -0
- package/dist/components/myCase/MyCase.jsx +26 -0
- package/dist/components/myCase/MyCase.tsx +47 -0
- package/dist/components/routes/gnb.d.ts +11 -0
- package/dist/components/routes/gnb.jsx +165 -0
- package/dist/components/routes/gnb.tsx +172 -0
- package/dist/styles/globals.css +324 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/header.d.ts +52 -0
- package/dist/types/header.js +1 -0
- package/dist/types/header.ts +54 -0
- package/package.json +1 -1
|
@@ -21,6 +21,40 @@ export const Default: Story = {
|
|
|
21
21
|
);
|
|
22
22
|
},
|
|
23
23
|
args: {
|
|
24
|
+
Title: (
|
|
25
|
+
<span className={'flex items-end pb-[1.1%] max-sm:items-center'}>
|
|
26
|
+
<p
|
|
27
|
+
className={
|
|
28
|
+
`!font-[NanumSquare] text-[173px] font-[800] leading-[0.8] tracking-[-3.46px] text-black max-3xl:text-[150px] max-xxl:text-[120px] max-lg:text-[90px] max-md:text-[80px] ` +
|
|
29
|
+
' max-sm:text-[100px] max-2xs:text-[70px] '
|
|
30
|
+
}
|
|
31
|
+
>
|
|
32
|
+
41
|
|
33
|
+
</p>
|
|
34
|
+
<span
|
|
35
|
+
className={
|
|
36
|
+
'justify-between pb-[8px] pl-[20px] max-3xl:pb-[6px] max-xxl:pb-[3px] max-lg:pl-[10px] max-sm:pl-3'
|
|
37
|
+
}
|
|
38
|
+
>
|
|
39
|
+
<h2
|
|
40
|
+
className={
|
|
41
|
+
'text-[30px] leading-tight tracking-[-0.6px] max-5xl:text-[24px] max-3xl:text-[20px] max-xl:text-[18px] max-md2:text-[17px] max-xs:pb-1 max-xs:text-[16px] lg:pb-1'
|
|
42
|
+
}
|
|
43
|
+
>
|
|
44
|
+
<span className={'font-[800] '}>전국41개</span> 사무소에서 <br className={'sm:hidden'} />
|
|
45
|
+
군변호사가 상담부터 함께!
|
|
46
|
+
</h2>
|
|
47
|
+
<p
|
|
48
|
+
className={
|
|
49
|
+
'text-[80px] font-[900] leading-none tracking-[-3.2px] ' +
|
|
50
|
+
'max-3xl:text-[70px] max-xxl:text-[60px] max-lg:text-[45px] max-md:text-[40px] max-sm:text-[45px] max-2xs:text-[35px]'
|
|
51
|
+
}
|
|
52
|
+
>
|
|
53
|
+
OFFICE
|
|
54
|
+
</p>
|
|
55
|
+
</span>
|
|
56
|
+
</span>
|
|
57
|
+
),
|
|
24
58
|
selectRegion: '대구·경북',
|
|
25
59
|
setMapFixOpen: () => {},
|
|
26
60
|
setSelectRegion: () => {},
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
const useBrowser = (isNotTimer) => {
|
|
3
|
+
const [dimensions, setDimensions] = useState({
|
|
4
|
+
width: 0,
|
|
5
|
+
height: 0
|
|
6
|
+
});
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (typeof window != 'undefined') {
|
|
9
|
+
let timer;
|
|
10
|
+
const handleResize = () => {
|
|
11
|
+
if (isNotTimer) {
|
|
12
|
+
//타이머 안쓰겠다
|
|
13
|
+
setDimensions({
|
|
14
|
+
width: window.innerWidth,
|
|
15
|
+
height: window.innerHeight
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
// 이전 타이머를 취소
|
|
20
|
+
clearTimeout(timer);
|
|
21
|
+
// 새로운 타이머를 설정
|
|
22
|
+
timer = setTimeout(() => {
|
|
23
|
+
setDimensions({
|
|
24
|
+
width: window.innerWidth,
|
|
25
|
+
height: window.innerHeight
|
|
26
|
+
});
|
|
27
|
+
}, 500);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
window.addEventListener('resize', handleResize);
|
|
31
|
+
return () => {
|
|
32
|
+
// cleanUp
|
|
33
|
+
clearTimeout(timer);
|
|
34
|
+
window.removeEventListener('resize', handleResize);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}, [dimensions]);
|
|
38
|
+
// 첫 렌더링 당시 width, height
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (dimensions.width === 0 || dimensions.height === 0) {
|
|
41
|
+
if (typeof window != 'undefined') {
|
|
42
|
+
setDimensions({
|
|
43
|
+
width: window.innerWidth,
|
|
44
|
+
height: window.innerHeight
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, []);
|
|
49
|
+
return dimensions;
|
|
50
|
+
};
|
|
51
|
+
export default useBrowser;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const useBrowser = (isNotTimer?: boolean) => {
|
|
4
|
+
const [dimensions, setDimensions] = useState({
|
|
5
|
+
width: 0,
|
|
6
|
+
height: 0
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (typeof window != 'undefined') {
|
|
11
|
+
let timer: ReturnType<typeof setTimeout>;
|
|
12
|
+
|
|
13
|
+
const handleResize = () => {
|
|
14
|
+
if (isNotTimer) {
|
|
15
|
+
//타이머 안쓰겠다
|
|
16
|
+
setDimensions({
|
|
17
|
+
width: window.innerWidth,
|
|
18
|
+
height: window.innerHeight
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
// 이전 타이머를 취소
|
|
22
|
+
clearTimeout(timer);
|
|
23
|
+
|
|
24
|
+
// 새로운 타이머를 설정
|
|
25
|
+
timer = setTimeout(() => {
|
|
26
|
+
setDimensions({
|
|
27
|
+
width: window.innerWidth,
|
|
28
|
+
height: window.innerHeight
|
|
29
|
+
});
|
|
30
|
+
}, 500);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
window.addEventListener('resize', handleResize);
|
|
35
|
+
|
|
36
|
+
return () => {
|
|
37
|
+
// cleanUp
|
|
38
|
+
clearTimeout(timer);
|
|
39
|
+
window.removeEventListener('resize', handleResize);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}, [dimensions]);
|
|
43
|
+
|
|
44
|
+
// 첫 렌더링 당시 width, height
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (dimensions.width === 0 || dimensions.height === 0) {
|
|
47
|
+
if (typeof window != 'undefined') {
|
|
48
|
+
setDimensions({
|
|
49
|
+
width: window.innerWidth,
|
|
50
|
+
height: window.innerHeight
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, []);
|
|
55
|
+
|
|
56
|
+
return dimensions;
|
|
57
|
+
};
|
|
58
|
+
export default useBrowser;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
function easeOutExpo(t, y) {
|
|
3
|
+
return t === 1 ? 1 : 1 - Math.pow(2, (y ? y : -5) * t);
|
|
4
|
+
}
|
|
5
|
+
const useCountNum = (end, start = 0, startFlag, customDelay) => {
|
|
6
|
+
const [count, setCount] = useState(start);
|
|
7
|
+
const frameRate = 1000 / 60;
|
|
8
|
+
const totalFrame = Math.round(2000 / frameRate);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (startFlag) {
|
|
11
|
+
let currentNumber = start;
|
|
12
|
+
const counter = setInterval(() => {
|
|
13
|
+
const progress = easeOutExpo(++currentNumber / totalFrame, customDelay);
|
|
14
|
+
setCount(Math.round(end * progress));
|
|
15
|
+
if (progress === 1) {
|
|
16
|
+
clearInterval(counter);
|
|
17
|
+
}
|
|
18
|
+
}, frameRate);
|
|
19
|
+
}
|
|
20
|
+
}, [end, frameRate, start, totalFrame, startFlag]);
|
|
21
|
+
return { count };
|
|
22
|
+
};
|
|
23
|
+
export default useCountNum;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
function easeOutExpo(t: number, y?: number): number {
|
|
4
|
+
return t === 1 ? 1 : 1 - Math.pow(2, (y ? y : -5) * t);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const useCountNum = (end: number, start = 0, startFlag?: boolean, customDelay?: number) => {
|
|
8
|
+
const [count, setCount] = useState<number>(start);
|
|
9
|
+
const frameRate = 1000 / 60;
|
|
10
|
+
const totalFrame = Math.round(2000 / frameRate);
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (startFlag) {
|
|
14
|
+
let currentNumber = start;
|
|
15
|
+
const counter = setInterval(() => {
|
|
16
|
+
const progress = easeOutExpo(++currentNumber / totalFrame, customDelay);
|
|
17
|
+
setCount(Math.round(end * progress));
|
|
18
|
+
|
|
19
|
+
if (progress === 1) {
|
|
20
|
+
clearInterval(counter);
|
|
21
|
+
}
|
|
22
|
+
}, frameRate);
|
|
23
|
+
}
|
|
24
|
+
}, [end, frameRate, start, totalFrame, startFlag]);
|
|
25
|
+
|
|
26
|
+
return { count };
|
|
27
|
+
};
|
|
28
|
+
export default useCountNum;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import style from '../components/main/main.module.css';
|
|
3
|
+
const useElementObserve = (targetRef, flagStandard) => {
|
|
4
|
+
const [flag, setFlag] = useState(false);
|
|
5
|
+
const [flagStandardBoolean, setFlagStandardBoolean] = useState(false);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const options = {
|
|
8
|
+
threshold: [0.1, ...(flagStandard ? [flagStandard] : [])]
|
|
9
|
+
};
|
|
10
|
+
const callback = (entries, observer) => {
|
|
11
|
+
entries.forEach((entry, index) => {
|
|
12
|
+
if (entry.isIntersecting) {
|
|
13
|
+
if (entry.intersectionRatio >= 0.1) {
|
|
14
|
+
setFlag(true);
|
|
15
|
+
}
|
|
16
|
+
if (flagStandard && entry.intersectionRatio >= flagStandard) {
|
|
17
|
+
setFlagStandardBoolean(true);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
const observer = new IntersectionObserver(callback, options);
|
|
23
|
+
if (targetRef.current) {
|
|
24
|
+
observer.observe(targetRef.current);
|
|
25
|
+
}
|
|
26
|
+
return () => {
|
|
27
|
+
if (targetRef.current) {
|
|
28
|
+
observer.unobserve(targetRef.current);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}, []);
|
|
32
|
+
return {
|
|
33
|
+
flag,
|
|
34
|
+
flagStandardBoolean,
|
|
35
|
+
flagClass: flag ? style.scroll_fade_in : 'opacity-0',
|
|
36
|
+
strengthClass: flag ? style.scroll_fade_in_strength : 'opacity-0'
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export default useElementObserve;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import style from '../components/main/main.module.css';
|
|
3
|
+
|
|
4
|
+
const useElementObserve = (targetRef: any, flagStandard?: number) => {
|
|
5
|
+
const [flag, setFlag] = useState<boolean>(false);
|
|
6
|
+
const [flagStandardBoolean, setFlagStandardBoolean] = useState<boolean>(false);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const options: IntersectionObserverInit = {
|
|
9
|
+
threshold: [0.1, ...(flagStandard ? [flagStandard] : [])]
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const callback: IntersectionObserverCallback = (entries, observer) => {
|
|
13
|
+
entries.forEach((entry, index) => {
|
|
14
|
+
if (entry.isIntersecting) {
|
|
15
|
+
if (entry.intersectionRatio >= 0.1) {
|
|
16
|
+
setFlag(true);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (flagStandard && entry.intersectionRatio >= flagStandard) {
|
|
20
|
+
setFlagStandardBoolean(true);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const observer = new IntersectionObserver(callback, options);
|
|
27
|
+
|
|
28
|
+
if (targetRef.current) {
|
|
29
|
+
observer.observe(targetRef.current);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return () => {
|
|
33
|
+
if (targetRef.current) {
|
|
34
|
+
observer.unobserve(targetRef.current);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}, []);
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
flag,
|
|
41
|
+
flagStandardBoolean,
|
|
42
|
+
flagClass: flag ? style.scroll_fade_in : 'opacity-0',
|
|
43
|
+
strengthClass: flag ? style.scroll_fade_in_strength : 'opacity-0'
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export default useElementObserve;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NextRouter } from 'next/router';
|
|
2
|
+
export declare function saveScrollPos(url: string): void;
|
|
3
|
+
export declare function restoreScrollPos(url: string): void;
|
|
4
|
+
export declare function removeScrollPos(url: string): void;
|
|
5
|
+
export default function useScrollRestoration(router: NextRouter): void;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import Router from 'next/router';
|
|
3
|
+
export function saveScrollPos(url) {
|
|
4
|
+
if (!(window.scrollX === 0 && window.scrollY === 0)) {
|
|
5
|
+
const scrollPos = { x: window.scrollX, y: window.scrollY };
|
|
6
|
+
sessionStorage.setItem(url, JSON.stringify(scrollPos));
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export function restoreScrollPos(url) {
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
const scrollPos = JSON.parse(sessionStorage.getItem(url));
|
|
12
|
+
if (scrollPos) {
|
|
13
|
+
window.scrollTo(scrollPos.x, scrollPos.y);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function removeScrollPos(url) {
|
|
17
|
+
sessionStorage.removeItem(url);
|
|
18
|
+
}
|
|
19
|
+
//스크롤 위치 저장 및 복구 훅
|
|
20
|
+
export default function useScrollRestoration(router) {
|
|
21
|
+
const [shouldScrollRestore, setShouldScrollRestore] = useState(false);
|
|
22
|
+
//뒤로가기로 접근할때 스크롤 복원, 페이지 떠날때 스크롤 저장
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if ('scrollRestoration' in window.history) {
|
|
25
|
+
window.history.scrollRestoration = 'manual';
|
|
26
|
+
const onRouteChangeStart = () => {
|
|
27
|
+
saveScrollPos(router.asPath);
|
|
28
|
+
};
|
|
29
|
+
Router.events.on('routeChangeStart', onRouteChangeStart);
|
|
30
|
+
window.addEventListener('popstate', () => {
|
|
31
|
+
setShouldScrollRestore(true);
|
|
32
|
+
});
|
|
33
|
+
return () => {
|
|
34
|
+
Router.events.off('routeChangeStart', onRouteChangeStart);
|
|
35
|
+
window.removeEventListener('popstate', () => { });
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}, [router]);
|
|
39
|
+
//뒤로가기 접근일시 스크롤 복원
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (shouldScrollRestore) {
|
|
42
|
+
const onRouteChangeComplete = (url) => {
|
|
43
|
+
if (shouldScrollRestore) {
|
|
44
|
+
restoreScrollPos(url);
|
|
45
|
+
//리스트 api로 스크롤 위치 안잡히는 페이지
|
|
46
|
+
if (!url.includes('/lawyer') &&
|
|
47
|
+
!url.includes('/partners') &&
|
|
48
|
+
!url.includes('/success') &&
|
|
49
|
+
!url.includes('/map') &&
|
|
50
|
+
!url.includes('/integrate'))
|
|
51
|
+
removeScrollPos(url);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
Router.events.on('routeChangeComplete', onRouteChangeComplete);
|
|
55
|
+
return () => {
|
|
56
|
+
Router.events.off('routeChangeComplete', onRouteChangeComplete);
|
|
57
|
+
setShouldScrollRestore(false);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}, [router, shouldScrollRestore]);
|
|
61
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import Router, { NextRouter } from 'next/router';
|
|
3
|
+
|
|
4
|
+
interface ScrollPosition {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function saveScrollPos(url: string) {
|
|
10
|
+
if (!(window.scrollX === 0 && window.scrollY === 0)) {
|
|
11
|
+
const scrollPos: ScrollPosition = { x: window.scrollX, y: window.scrollY };
|
|
12
|
+
sessionStorage.setItem(url, JSON.stringify(scrollPos));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function restoreScrollPos(url: string) {
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
const scrollPos: ScrollPosition = JSON.parse(sessionStorage.getItem(url));
|
|
19
|
+
|
|
20
|
+
if (scrollPos) {
|
|
21
|
+
window.scrollTo(scrollPos.x, scrollPos.y);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function removeScrollPos(url: string) {
|
|
25
|
+
sessionStorage.removeItem(url);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//스크롤 위치 저장 및 복구 훅
|
|
29
|
+
export default function useScrollRestoration(router: NextRouter) {
|
|
30
|
+
const [shouldScrollRestore, setShouldScrollRestore] = useState<boolean>(false);
|
|
31
|
+
|
|
32
|
+
//뒤로가기로 접근할때 스크롤 복원, 페이지 떠날때 스크롤 저장
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if ('scrollRestoration' in window.history) {
|
|
35
|
+
window.history.scrollRestoration = 'manual';
|
|
36
|
+
|
|
37
|
+
const onRouteChangeStart = () => {
|
|
38
|
+
saveScrollPos(router.asPath);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
Router.events.on('routeChangeStart', onRouteChangeStart);
|
|
42
|
+
|
|
43
|
+
window.addEventListener('popstate', () => {
|
|
44
|
+
setShouldScrollRestore(true);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return () => {
|
|
48
|
+
Router.events.off('routeChangeStart', onRouteChangeStart);
|
|
49
|
+
window.removeEventListener('popstate', () => {});
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}, [router]);
|
|
53
|
+
|
|
54
|
+
//뒤로가기 접근일시 스크롤 복원
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (shouldScrollRestore) {
|
|
57
|
+
const onRouteChangeComplete = (url: string) => {
|
|
58
|
+
if (shouldScrollRestore) {
|
|
59
|
+
restoreScrollPos(url);
|
|
60
|
+
//리스트 api로 스크롤 위치 안잡히는 페이지
|
|
61
|
+
if (
|
|
62
|
+
!url.includes('/lawyer') &&
|
|
63
|
+
!url.includes('/partners') &&
|
|
64
|
+
!url.includes('/success') &&
|
|
65
|
+
!url.includes('/map') &&
|
|
66
|
+
!url.includes('/integrate')
|
|
67
|
+
)
|
|
68
|
+
removeScrollPos(url);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
Router.events.on('routeChangeComplete', onRouteChangeComplete);
|
|
73
|
+
|
|
74
|
+
return () => {
|
|
75
|
+
Router.events.off('routeChangeComplete', onRouteChangeComplete);
|
|
76
|
+
setShouldScrollRestore(false);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}, [router, shouldScrollRestore]);
|
|
80
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { removeScrollPos, restoreScrollPos } from './useScrollRestoration';
|
|
3
|
+
//리스트나 특정 플래그가 필요할 때 사용하는 스크롤 훅
|
|
4
|
+
export default function useScrollRestorationException(router, list) {
|
|
5
|
+
const [isFromBack, setIsFromBack] = useState(false);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (list.length > 0 && isFromBack) {
|
|
8
|
+
restoreScrollPos(router.asPath);
|
|
9
|
+
removeScrollPos(router.asPath);
|
|
10
|
+
}
|
|
11
|
+
}, [list, isFromBack]);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
// 페이지 이동 시 이전 경로 저장
|
|
14
|
+
const handleRouteChange = ({ shallow }) => {
|
|
15
|
+
if (!shallow) {
|
|
16
|
+
setIsFromBack(true);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
router.events.on('routeChangeComplete', handleRouteChange);
|
|
20
|
+
return () => {
|
|
21
|
+
router.events.off('routeChangeComplete', handleRouteChange);
|
|
22
|
+
};
|
|
23
|
+
}, []);
|
|
24
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Router, { NextRouter } from 'next/router';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { removeScrollPos, restoreScrollPos } from './useScrollRestoration';
|
|
4
|
+
|
|
5
|
+
//리스트나 특정 플래그가 필요할 때 사용하는 스크롤 훅
|
|
6
|
+
export default function useScrollRestorationException(router: NextRouter, list: any[]) {
|
|
7
|
+
const [isFromBack, setIsFromBack] = useState(false);
|
|
8
|
+
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (list.length > 0 && isFromBack) {
|
|
11
|
+
restoreScrollPos(router.asPath);
|
|
12
|
+
removeScrollPos(router.asPath);
|
|
13
|
+
}
|
|
14
|
+
}, [list, isFromBack]);
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
// 페이지 이동 시 이전 경로 저장
|
|
18
|
+
const handleRouteChange = ({ shallow }: { shallow: boolean }) => {
|
|
19
|
+
if (!shallow) {
|
|
20
|
+
setIsFromBack(true);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
router.events.on('routeChangeComplete', handleRouteChange);
|
|
25
|
+
|
|
26
|
+
return () => {
|
|
27
|
+
router.events.off('routeChangeComplete', handleRouteChange);
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
}
|
package/dist/components/index.js
CHANGED
|
@@ -7,4 +7,5 @@ export { default as CategoryView } from './categoryView/CategoryView';
|
|
|
7
7
|
export { default as CountingSection } from './CountingSection/CountingSection';
|
|
8
8
|
export { default as LogoSection } from './LogoSection/LogoSection';
|
|
9
9
|
export { default as MapSection } from './MapSection/MapSection';
|
|
10
|
+
export { default as Header } from './Header/Header';
|
|
10
11
|
export { default as Wrapper } from './Layout/Wrapper';
|
package/dist/components/index.ts
CHANGED
|
@@ -7,4 +7,5 @@ export { default as CategoryView } from './categoryView/CategoryView';
|
|
|
7
7
|
export { default as CountingSection } from './CountingSection/CountingSection';
|
|
8
8
|
export { default as LogoSection } from './LogoSection/LogoSection';
|
|
9
9
|
export { default as MapSection } from './MapSection/MapSection';
|
|
10
|
+
export { default as Header } from './Header/Header';
|
|
10
11
|
export { default as Wrapper } from './Layout/Wrapper';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
const MyCase = (props) => {
|
|
3
|
+
//전체 body 스크롤 잠금
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
document.body.style.overflow = 'hidden';
|
|
6
|
+
return () => {
|
|
7
|
+
document.body.style.overflow = 'visible';
|
|
8
|
+
};
|
|
9
|
+
}, []);
|
|
10
|
+
return (<>
|
|
11
|
+
<div className={'w-full h-[100vh] top-0 left-0 z-[900] fixed'}>
|
|
12
|
+
<div className={'w-full h-full bg-black bg-opacity-80 absolute top-0 left-0 z-[1]'}></div>
|
|
13
|
+
<div className={'w-[80%] h-[80%] px-[20px] max-w-[1000px] max-h-[1200px] bg-white z-[2] absolute bottom-[50%] translate-y-[50%] left-[50%] translate-x-[-50%] ' +
|
|
14
|
+
//1024px
|
|
15
|
+
'max-lg:w-full max-lg:h-[calc(100%-60px)] max-lg:bottom-0 max-lg:translate-y-0 max-lg:px-[10px] max-lg:pt-[10px] max-lg:pb-[100px]'}>
|
|
16
|
+
<button type={'button'} className={'text-[35px] text-white absolute top-[-50px] right-[-40px] ' +
|
|
17
|
+
//1024px
|
|
18
|
+
' max-lg:text-[25px] max-lg:right-[10px] max-lg:top-[-45px]'} onClick={props.onClick}>
|
|
19
|
+
✕
|
|
20
|
+
</button>
|
|
21
|
+
<iframe width="100%" height="100%" title="나의 사건검색" src="https://safind.scourt.go.kr/sf/mysafind.jsp?sch_sa_gbn=&sch_bub_nm=&sa_year=&sa_gubun=&sa_serial=&x=&y=&saveCookie="></iframe>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</>);
|
|
25
|
+
};
|
|
26
|
+
export default MyCase;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const MyCase = (props: { onClick: () => void }) => {
|
|
4
|
+
//전체 body 스크롤 잠금
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
document.body.style.overflow = 'hidden';
|
|
7
|
+
|
|
8
|
+
return () => {
|
|
9
|
+
document.body.style.overflow = 'visible';
|
|
10
|
+
};
|
|
11
|
+
}, []);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<div className={'w-full h-[100vh] top-0 left-0 z-[900] fixed'}>
|
|
16
|
+
<div className={'w-full h-full bg-black bg-opacity-80 absolute top-0 left-0 z-[1]'}></div>
|
|
17
|
+
<div
|
|
18
|
+
className={
|
|
19
|
+
'w-[80%] h-[80%] px-[20px] max-w-[1000px] max-h-[1200px] bg-white z-[2] absolute bottom-[50%] translate-y-[50%] left-[50%] translate-x-[-50%] ' +
|
|
20
|
+
//1024px
|
|
21
|
+
'max-lg:w-full max-lg:h-[calc(100%-60px)] max-lg:bottom-0 max-lg:translate-y-0 max-lg:px-[10px] max-lg:pt-[10px] max-lg:pb-[100px]'
|
|
22
|
+
}
|
|
23
|
+
>
|
|
24
|
+
<button
|
|
25
|
+
type={'button'}
|
|
26
|
+
className={
|
|
27
|
+
'text-[35px] text-white absolute top-[-50px] right-[-40px] ' +
|
|
28
|
+
//1024px
|
|
29
|
+
' max-lg:text-[25px] max-lg:right-[10px] max-lg:top-[-45px]'
|
|
30
|
+
}
|
|
31
|
+
onClick={props.onClick}
|
|
32
|
+
>
|
|
33
|
+
✕
|
|
34
|
+
</button>
|
|
35
|
+
<iframe
|
|
36
|
+
width="100%"
|
|
37
|
+
height="100%"
|
|
38
|
+
title="나의 사건검색"
|
|
39
|
+
src="https://safind.scourt.go.kr/sf/mysafind.jsp?sch_sa_gbn=&sch_bub_nm=&sa_year=&sa_gubun=&sa_serial=&x=&y=&saveCookie="
|
|
40
|
+
></iframe>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default MyCase;
|