mirror of
https://github.com/hanzo-apps/industries.git
synced 2026-11-02 05:26:51 +00:00
- 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
20 lines
565 B
TypeScript
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
|
|
}
|