UNPKG

grommet

Version:

focus on the essential experience

27 lines (25 loc) 798 B
export var getBreakpoint = function getBreakpoint(windowWidth, theme) { var result; Object.keys(theme.global.breakpoints).sort(function (a, b) { var first = theme.global.breakpoints[a]; var second = theme.global.breakpoints[b]; if (!first) return 1; if (!second) return -1; if (!first.value) return 1; if (!second.value) return -1; return first.value - second.value; }).some(function (name) { var breakpoint = theme.global.breakpoints[name]; if (breakpoint) { if (!breakpoint.value || breakpoint.value >= windowWidth) { result = name; return true; } } return false; }); return result; }; export var getDeviceBreakpoint = function getDeviceBreakpoint(type, theme) { return theme.global.deviceBreakpoints[type]; };