feat(catalyst): add useBreakpoint hook for responsive wizard layout
Missing file that was created locally but never committed. Provides mobile/tablet/desktop breakpoint detection used across all wizard steps. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2e4d18cba5
commit
5c053e4133
@ -0,0 +1,20 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
|
||||
export type Breakpoint = 'mobile' | 'tablet' | 'desktop'
|
||||
|
||||
function getBreakpoint(): Breakpoint {
|
||||
if (typeof window === 'undefined') return 'desktop'
|
||||
if (window.innerWidth < 768) return 'mobile'
|
||||
if (window.innerWidth < 1080) return 'tablet'
|
||||
return 'desktop'
|
||||
}
|
||||
|
||||
export function useBreakpoint(): Breakpoint {
|
||||
const [bp, setBp] = useState<Breakpoint>(getBreakpoint)
|
||||
useEffect(() => {
|
||||
const handler = () => setBp(getBreakpoint())
|
||||
window.addEventListener('resize', handler)
|
||||
return () => window.removeEventListener('resize', handler)
|
||||
}, [])
|
||||
return bp
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user