UNPKG

@shopify/polaris

Version:

Shopify’s admin product component library

30 lines (25 loc) 696 B
const Breakpoints = { navigationBarCollapsed: '768px', stackedContent: '1043px', }; const noWindowMatches: MediaQueryList = { media: '', addListener: noop, removeListener: noop, matches: false, onchange: noop, addEventListener: noop, removeEventListener: noop, dispatchEvent: (_: Event) => true, }; function noop() {} export function navigationBarCollapsed() { return typeof window === 'undefined' ? noWindowMatches : window.matchMedia(`(max-width: ${Breakpoints.navigationBarCollapsed})`); } export function stackedContent() { return typeof window === 'undefined' ? noWindowMatches : window.matchMedia(`(max-width: ${Breakpoints.stackedContent})`); }