()
| 34 | } |
| 35 | |
| 36 | function useIsDesktop(): boolean { |
| 37 | const query = '(min-width: 768px)' |
| 38 | const [matches, setMatches] = useState(() => |
| 39 | typeof window !== 'undefined' ? window.matchMedia(query).matches : true, |
| 40 | ) |
| 41 | |
| 42 | useEffect(() => { |
| 43 | const mq = window.matchMedia(query) |
| 44 | const handler = () => setMatches(mq.matches) |
| 45 | setMatches(mq.matches) |
| 46 | mq.addEventListener('change', handler) |
| 47 | return () => mq.removeEventListener('change', handler) |
| 48 | }, []) |
| 49 | |
| 50 | return matches |
| 51 | } |
| 52 | |
| 53 | interface PageSidebarLayoutProps { |
| 54 | storageKey: string |
no test coverage detected