Files
industries/hooks/use-mobile.tsx
zeekay 58cb91619b feat: migrate from Vite SPA to Next.js 15 + monochrome + @hanzo/ui
- Replace React Router SPA with Next.js App Router (output: 'export')
- Upgrade React 18 → 19, Tailwind CSS 3 → 4
- Replace all shadcn/ui components with @hanzo/ui package
- Strip all color accents to pure black/white/gray monochrome
- Remove theme switching (dark-only, no useTheme())
- 44 static pages including 12 dynamic product routes
- Deploy workflow updated for pnpm + Next.js
- Remove Vite, React Router, old PostCSS/Tailwind configs
2026-02-22 15:54:00 -08:00

20 lines
565 B
TypeScript

import * as React from "react"
const MOBILE_BREAKPOINT = 768
export function useIsMobile() {
const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
React.useEffect(() => {
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)
}, [])
return !!isMobile
}