Nicholai bba1bab8c2 feat(components): initialize custom component library with foundational files
- Added essential configuration files including components.json, package.json, and tsconfig.json to establish the component library structure.
- Introduced global styles in globals.css and layout structure in layout.tsx for consistent design application.
- Implemented various UI components such as Accordion, AlertDialog, Button, Card, and more, enhancing the component library for future development.
- Included utility functions and hooks to support component functionality and responsiveness.

This commit sets up the groundwork for a comprehensive UI component library, facilitating a modular and scalable design system.
2025-11-25 03:01:30 -07: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
}