@shopify/polaris
Version:
Shopify’s product component library
26 lines (25 loc) • 710 B
JavaScript
const Breakpoints = {
navigationBarCollapsed: '768px',
stackedContent: '1043px',
};
const noWindowMatches = {
media: '',
addListener: noop,
removeListener: noop,
matches: false,
onchange: noop,
addEventListener: noop,
removeEventListener: noop,
dispatchEvent: (_) => 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})`);
}