UNPKG

@stanfordspezi/spezi-web-design-system

Version:

Stanford Biodesign Digital Health Spezi Web Design System

26 lines (25 loc) 605 B
import { useState as o, useEffect as i } from "react"; const r = { sm: "640px", md: "768px", lg: "1024px", xl: "1280px", "2xl": "1536px" }, a = (e) => { const [t, n] = o( () => typeof window < "u" && window.matchMedia(e).matches ); return i(() => { const s = window.matchMedia(e); n(s.matches); const c = () => { n(s.matches); }; return s.addEventListener("change", c), () => s.removeEventListener("change", c); }, [e]), t; }, m = () => a("(pointer: coarse)"), h = (e) => (t) => a(`(min-width: ${e[t]})`), p = h(r); export { m as a, h as c, p as u };