UNPKG

982 BJavaScriptView Raw
1"use strict";
2
3exports.__esModule = true;
4exports.getDeviceBreakpoint = exports.getBreakpoint = void 0;
5
6var getBreakpoint = function getBreakpoint(windowWidth, theme) {
7 var result;
8 Object.keys(theme.global.breakpoints).sort(function (a, b) {
9 var first = theme.global.breakpoints[a];
10 var second = theme.global.breakpoints[b];
11 if (!first) return 1;
12 if (!second) return -1;
13 if (!first.value) return 1;
14 if (!second.value) return -1;
15 return first.value - second.value;
16 }).some(function (name) {
17 var breakpoint = theme.global.breakpoints[name];
18
19 if (breakpoint) {
20 if (!breakpoint.value || breakpoint.value >= windowWidth) {
21 result = name;
22 return true;
23 }
24 }
25
26 return false;
27 });
28 return result;
29};
30
31exports.getBreakpoint = getBreakpoint;
32
33var getDeviceBreakpoint = function getDeviceBreakpoint(type, theme) {
34 return theme.global.deviceBreakpoints[type];
35};
36
37exports.getDeviceBreakpoint = getDeviceBreakpoint;
\No newline at end of file