@lotte-innovate/ui-component-test 0.0.151 → 0.0.153
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/lib/components/SideBar/index.js +3 -3
- package/dist/lib/components/SideBar/index.mjs +1 -1
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/dist/lib/utils/useWindowSize.js +7 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/lib/utils/useWindowSize.mjs +0 -2
- package/dist/lib/utils/useWindowSize.mjs.map +0 -1
@@ -4,6 +4,9 @@ export function useWindowSize() {
|
|
4
4
|
var _a = useState(MIN_SIZE), size = _a[0], setSize = _a[1];
|
5
5
|
useEffect(function () {
|
6
6
|
function handleResize() {
|
7
|
+
if (typeof window == undefined)
|
8
|
+
return;
|
9
|
+
console.log(window);
|
7
10
|
var width = 130 + window.innerWidth * 0.15;
|
8
11
|
width = Math.max(width, MIN_SIZE);
|
9
12
|
width = Math.min(width, 300);
|
@@ -12,7 +15,10 @@ export function useWindowSize() {
|
|
12
15
|
if (typeof window !== undefined)
|
13
16
|
window.addEventListener('resize', handleResize);
|
14
17
|
handleResize();
|
15
|
-
return function () {
|
18
|
+
return function () {
|
19
|
+
if (typeof window !== undefined)
|
20
|
+
window.removeEventListener('resize', handleResize);
|
21
|
+
};
|
16
22
|
}, []);
|
17
23
|
return size;
|
18
24
|
}
|