forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbreakpoints.ts
More file actions
34 lines (30 loc) · 968 Bytes
/
breakpoints.ts
File metadata and controls
34 lines (30 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
export const media = {
between(lowerBound, upperBound, excludeLarge = false) {
if (excludeLarge)
return `@media (min-width: ${
lowerBound.min
}px) and (max-width: ${upperBound.min - 1}px)`;
if (upperBound.max === Infinity)
return `@media (min-width: lowerBound.min}px)`;
return `@media (min-width: lowerBound.min}px) and (max-width: ${upperBound.max}px)`;
},
greaterThan(size) {
return `@media (min-width: ${size.min}px)`;
},
lessThan(size) {
return `@media (max-width: ${size.min - 1}px)`;
},
size(size) {
if (size.min === null) return media.lessThan(size);
if (size.max === null) return media.greaterThan(size);
return media.between(size, size);
},
};
export const sizes = {
xsmall: { min: 0, max: 599 },
small: { min: 600, max: 779 },
medium: { min: 780, max: 979 },
large: { min: 980, max: 1279 },
xlarge: { min: 1280, max: 1339 },
xxlarge: { min: 1340, max: Infinity },
};