1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

fixed mobile appearance of dialogs

This commit is contained in:
Fedor Katurov 2022-07-14 13:26:53 +07:00
parent 4483d7a0f5
commit 042f238590
8 changed files with 25 additions and 19 deletions

View file

@ -1,10 +1,15 @@
import { useCallback, useEffect, useState } from 'react';
export const useWindowSize = () => {
const [size, setSize] = useState({ innerWidth: 0, innerHeight: 0 });
const [size, setSize] = useState({ innerWidth: 0, innerHeight: 0, isMobile: false });
const onResize = useCallback(
() => setSize({ innerWidth: window.innerWidth, innerHeight: window.innerHeight }),
() =>
setSize({
innerWidth: window.innerWidth,
innerHeight: window.innerHeight,
isMobile: window.innerWidth < 768,
}),
[]
);