Spaces:
Paused
Paused
Download client/src/hooks/useAppHeight.jsx from arabdullah/chatty: direct link, hf CLI and curl.
- Browser
- Download file 431 Bytes
-
https://huggingface.co/spaces/arabdullah/chatty/resolve/main/client/src/hooks/useAppHeight.jsx
- Command line
-
hf download hf://spaces/arabdullah/chatty/client/src/hooks/useAppHeight.jsx
-
curl -L -o useAppHeight.jsx https://huggingface.co/spaces/arabdullah/chatty/resolve/main/client/src/hooks/useAppHeight.jsx
431 Bytes
| const useAppHeight = () => { | |
| const setHeight = () => { | |
| document.querySelector("#root").style.height = window.innerHeight + "px"; | |
| }; | |
| const deviceWidth = window.matchMedia("(max-width: 1024px)"); | |
| if (deviceWidth.matches) { | |
| // set an event listener that detects when innerHeight changes: | |
| window.addEventListener("resize", setHeight); | |
| } | |
| // set initial height: | |
| setHeight(); | |
| }; | |
| export default useAppHeight; | |