| import * as React from "react"; | |
| const MOBILE_BREAKPOINT = 768; | |
| export function useIsMobile() { | |
| const [isMobile, setIsMobile] = React.useState<boolean>(false); | |
| React.useEffect(() => { | |
| // Check actual viewport width | |
| const checkMobile = () => { | |
| setIsMobile(window.innerWidth < MOBILE_BREAKPOINT); | |
| }; | |
| checkMobile(); | |
| window.addEventListener("resize", checkMobile); | |
| return () => window.removeEventListener("resize", checkMobile); | |
| }, []); | |
| return isMobile; | |
| } | |