- Upgrade Nx 22.1.1 → 22.6.3 and all patch/minor dependencies - Restructure shared libs: move business logic from utils to service - Consolidate shadcn-ui into ui lib with atomic design pattern - Fix container centering for landing app (Tailwind v4 compatibility) - Fix button styling by updating @source directive in globals.css - Fix SiCss3 → SiCss rename in react-icons 5.6 - Fix duplicate useSession export conflict - Remove dead code, comments, and unused files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
31 lines
652 B
TypeScript
31 lines
652 B
TypeScript
'use client';
|
|
|
|
import { useEffect, useState } from 'react';
|
|
|
|
export function useMediaQuery(query: string): boolean {
|
|
const [matches, setMatches] = useState(false);
|
|
|
|
useEffect(() => {
|
|
if (typeof window === 'undefined') {
|
|
return;
|
|
}
|
|
|
|
const mediaQueryList = window.matchMedia(query);
|
|
|
|
setMatches(mediaQueryList.matches);
|
|
|
|
const listener = (event: MediaQueryListEvent) => {
|
|
setMatches(event.matches);
|
|
};
|
|
mediaQueryList.addEventListener('change', listener);
|
|
|
|
return () => {
|
|
mediaQueryList.removeEventListener('change', listener);
|
|
};
|
|
}, [query]);
|
|
|
|
return matches;
|
|
}
|
|
|
|
export default useMediaQuery;
|