summaryrefslogtreecommitdiff
path: root/apps/web/src/hooks/use-mobile.tsx
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2025-07-25 15:34:53 +0200
committerMaze Winther <mazewinther@gmail.com>2025-07-25 15:34:53 +0200
commitd667c1095c58490bfdabbf50e044384e7fee943d (patch)
treed1ee64ed535843a83ff14211a92708dcbadf765e /apps/web/src/hooks/use-mobile.tsx
parent9a18a7a4e961375f80417d50a3c326c63e74dfe8 (diff)
parent65c3f9f7f78f787262a88c75b96a118ca5bee15c (diff)
downloadopencut-d667c1095c58490bfdabbf50e044384e7fee943d.tar.gz
Merge branch 'staging' of https://github.com/mazeincoding/AppCut into staging
Diffstat (limited to 'apps/web/src/hooks/use-mobile.tsx')
-rw-r--r--apps/web/src/hooks/use-mobile.tsx24
1 files changed, 13 insertions, 11 deletions
diff --git a/apps/web/src/hooks/use-mobile.tsx b/apps/web/src/hooks/use-mobile.tsx
index 2b0fe1df..48fab93c 100644
--- a/apps/web/src/hooks/use-mobile.tsx
+++ b/apps/web/src/hooks/use-mobile.tsx
@@ -1,19 +1,21 @@
-import * as React from "react"
+import * as React from "react";
-const MOBILE_BREAKPOINT = 768
+const MOBILE_BREAKPOINT = 768;
export function useIsMobile() {
- const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
+ const [isMobile, setIsMobile] = React.useState<boolean | undefined>(
+ undefined
+ );
React.useEffect(() => {
- const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
+ const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
const onChange = () => {
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
- }
- mql.addEventListener("change", onChange)
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
- return () => mql.removeEventListener("change", onChange)
- }, [])
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
+ };
+ mql.addEventListener("change", onChange);
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
+ return () => mql.removeEventListener("change", onChange);
+ }, []);
- return !!isMobile
+ return !!isMobile;
}