@daeryun/dr_components 0.9.7 → 0.9.8
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/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/components/Daeryuntalk/ChatConversation.jsx +1 -1
- package/dist/components/Daeryuntalk/ChatConversation.tsx +3 -1
- package/dist/components/Daeryuntalk/HomeView.jsx +7 -5
- package/dist/components/Daeryuntalk/HomeView.tsx +6 -5
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.js +12 -2
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.ts +16 -2
- package/dist/components/Daeryuntalk/_hooks/useScrollShadow.d.ts +1 -0
- package/dist/components/Daeryuntalk/_hooks/useScrollShadow.js +20 -5
- package/dist/components/Daeryuntalk/_hooks/useScrollShadow.ts +23 -5
- package/dist/components/Daeryuntalk/index.jsx +2 -2
- package/dist/components/Daeryuntalk/index.tsx +2 -2
- package/dist/components/common/integrate/index.d.ts +1 -1
- package/dist/styles/globals.css +334 -789
- package/dist/styles/homepage_login.css +173 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { useEffect, useRef, useState
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
export function useScrollShadow<T extends HTMLElement>() {
|
|
4
4
|
const containerRef = useRef<T | null>(null);
|
|
5
5
|
const [isScroll, setIsScroll] = useState(false);
|
|
6
6
|
const [isBottom, setIsBottom] = useState(false);
|
|
7
|
+
const [isScrolling, setIsScrolling] = useState(false);
|
|
8
|
+
const scrollTimeoutRef = useRef<NodeJS.Timeout | null>(null);
|
|
7
9
|
|
|
8
10
|
const checkScroll = useCallback(() => {
|
|
9
11
|
const container = containerRef.current;
|
|
@@ -16,19 +18,35 @@ export function useScrollShadow<T extends HTMLElement>() {
|
|
|
16
18
|
setIsBottom(scrollPercentage >= 0.98);
|
|
17
19
|
}, []);
|
|
18
20
|
|
|
21
|
+
const handleScroll = useCallback(() => {
|
|
22
|
+
checkScroll();
|
|
23
|
+
setIsScrolling(true);
|
|
24
|
+
|
|
25
|
+
if (scrollTimeoutRef.current) {
|
|
26
|
+
clearTimeout(scrollTimeoutRef.current);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
scrollTimeoutRef.current = setTimeout(() => {
|
|
30
|
+
setIsScrolling(false);
|
|
31
|
+
}, 800); // 스크롤 멈춘 후 800ms 뒤 isScrolling false
|
|
32
|
+
}, [checkScroll]);
|
|
33
|
+
|
|
19
34
|
useEffect(() => {
|
|
20
35
|
const container = containerRef.current;
|
|
21
36
|
if (!container) return;
|
|
22
37
|
|
|
23
|
-
container.addEventListener('scroll',
|
|
38
|
+
container.addEventListener('scroll', handleScroll);
|
|
24
39
|
|
|
25
40
|
// mount 시 초기 상태 확인
|
|
26
41
|
checkScroll();
|
|
27
42
|
|
|
28
43
|
return () => {
|
|
29
|
-
container.removeEventListener('scroll',
|
|
44
|
+
container.removeEventListener('scroll', handleScroll);
|
|
45
|
+
if (scrollTimeoutRef.current) {
|
|
46
|
+
clearTimeout(scrollTimeoutRef.current);
|
|
47
|
+
}
|
|
30
48
|
};
|
|
31
|
-
}, [checkScroll]);
|
|
49
|
+
}, [handleScroll, checkScroll]);
|
|
32
50
|
|
|
33
|
-
return { containerRef, isScroll, isBottom, checkScroll };
|
|
51
|
+
return { containerRef, isScroll, isBottom, isScrolling, checkScroll };
|
|
34
52
|
}
|
|
@@ -31,7 +31,7 @@ const Daeryuntalk = ({ tel = '1800-7905', centerCode = 'CT0000' }) => {
|
|
|
31
31
|
}, 300);
|
|
32
32
|
};
|
|
33
33
|
useEffect(() => {
|
|
34
|
-
if (isOpen
|
|
34
|
+
if (isOpen) {
|
|
35
35
|
document.body.style.overflow = 'hidden';
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
@@ -74,7 +74,7 @@ const Daeryuntalk = ({ tel = '1800-7905', centerCode = 'CT0000' }) => {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
}, []);
|
|
77
|
-
return (<div className="daeryuntalk-wrapper">
|
|
77
|
+
return (<div className="daeryuntalk-wrapper my-scroll-container">
|
|
78
78
|
<DaeryuntalkToastProvider>
|
|
79
79
|
<ViewportHandler />
|
|
80
80
|
<DaeryuntalkProvider propsTel={tel} isMobile={isMobile} onClose={closeModal} centerCode={centerCode}>
|
|
@@ -44,7 +44,7 @@ const Daeryuntalk: React.FC<DaeryuntalkProps> = ({ tel = '1800-7905', centerCode
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
useEffect(() => {
|
|
47
|
-
if (isOpen
|
|
47
|
+
if (isOpen) {
|
|
48
48
|
document.body.style.overflow = 'hidden';
|
|
49
49
|
} else {
|
|
50
50
|
document.body.style.overflow = '';
|
|
@@ -94,7 +94,7 @@ const Daeryuntalk: React.FC<DaeryuntalkProps> = ({ tel = '1800-7905', centerCode
|
|
|
94
94
|
}, []);
|
|
95
95
|
|
|
96
96
|
return (
|
|
97
|
-
<div className="daeryuntalk-wrapper">
|
|
97
|
+
<div className="daeryuntalk-wrapper my-scroll-container">
|
|
98
98
|
<DaeryuntalkToastProvider>
|
|
99
99
|
<ViewportHandler />
|
|
100
100
|
<DaeryuntalkProvider propsTel={tel} isMobile={isMobile} onClose={closeModal} centerCode={centerCode}>
|