2017-02-20 18:15:36 +02:00
|
|
|
import { css } from 'styled-components';
|
2017-05-18 21:21:33 +03:00
|
|
|
import remcalc from 'remcalc';
|
2017-02-20 18:15:36 +02:00
|
|
|
|
2017-06-15 19:44:04 +03:00
|
|
|
export const breakpoints = {
|
2017-02-20 18:15:36 +02:00
|
|
|
small: {
|
2017-06-15 19:44:04 +03:00
|
|
|
upper: 768
|
2017-02-20 18:15:36 +02:00
|
|
|
},
|
|
|
|
medium: {
|
2017-06-15 19:44:04 +03:00
|
|
|
upper: 1024,
|
|
|
|
lower: 769
|
2017-02-20 18:15:36 +02:00
|
|
|
},
|
|
|
|
large: {
|
2017-06-15 19:44:04 +03:00
|
|
|
upper: 1200,
|
|
|
|
lower: 1025
|
2017-02-20 18:15:36 +02:00
|
|
|
},
|
|
|
|
xlarge: {
|
2017-06-15 19:44:04 +03:00
|
|
|
lower: 1201
|
2017-02-20 18:15:36 +02:00
|
|
|
}
|
2017-02-03 13:25:29 +02:00
|
|
|
};
|
|
|
|
|
2017-01-03 17:46:43 +02:00
|
|
|
const screens = {
|
|
|
|
// >= 768px
|
2017-06-15 19:44:04 +03:00
|
|
|
smallOnly: `only screen and (max-width: ${remcalc(breakpoints.small.upper)})`,
|
|
|
|
small: `only screen and (min-width: ${remcalc(breakpoints.small.upper)})`,
|
2017-01-03 17:46:43 +02:00
|
|
|
// >= 1024px
|
2017-06-15 19:44:04 +03:00
|
|
|
mediumOnly: `only screen and (min-width: ${remcalc(breakpoints.medium.lower)})
|
|
|
|
and (max-width: ${remcalc(breakpoints.medium.upper)})`,
|
|
|
|
mediumDown: `only screen and (max-width: ${remcalc(
|
|
|
|
breakpoints.medium.upper
|
|
|
|
)})`,
|
|
|
|
medium: `only screen and (min-width: ${remcalc(breakpoints.medium.lower)})`,
|
2017-01-03 17:46:43 +02:00
|
|
|
// >= 1200px
|
2017-06-15 19:44:04 +03:00
|
|
|
largeOnly: `only screen and (min-width: ${remcalc(breakpoints.large.lower)})
|
|
|
|
and (max-width: ${remcalc(breakpoints.large.upper)})`,
|
|
|
|
largeDown: `only screen and (max-width: ${remcalc(breakpoints.large.upper)})`,
|
|
|
|
large: `only screen and (min-width: ${remcalc(breakpoints.large.upper)})`,
|
|
|
|
xlarge: `only screen and (min-width: ${remcalc(breakpoints.xlarge.lower)})
|
|
|
|
and (max-width: ${remcalc(breakpoints.xlarge.upper)})`,
|
|
|
|
xlargeUp: `only screen and (min-width: ${remcalc(breakpoints.xlarge.lower)})`
|
2017-01-03 17:46:43 +02:00
|
|
|
};
|
|
|
|
|
2017-05-18 21:21:33 +03:00
|
|
|
const breakpoint = label => (...args) => css`
|
2017-02-20 18:15:36 +02:00
|
|
|
@media ${screens[label]} {
|
|
|
|
${css(...args)}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const smallOnly = breakpoint('smallOnly');
|
|
|
|
export const small = breakpoint('small');
|
|
|
|
export const mediumOnly = breakpoint('mediumOnly');
|
|
|
|
export const mediumDown = breakpoint('mediumDown');
|
|
|
|
export const medium = breakpoint('medium');
|
|
|
|
export const largeOnly = breakpoint('largeOnly');
|
|
|
|
export const largeDown = breakpoint('largeDown');
|
|
|
|
export const large = breakpoint('large');
|
|
|
|
export const xlarge = breakpoint('xlarge');
|
|
|
|
export const xlargeUp = breakpoint('xlargeUp');
|
2017-05-18 21:21:33 +03:00
|
|
|
|
|
|
|
export default {
|
|
|
|
smallOnly,
|
|
|
|
small,
|
|
|
|
mediumOnly,
|
|
|
|
mediumDown,
|
|
|
|
medium,
|
|
|
|
largeOnly,
|
|
|
|
largeDown,
|
|
|
|
large,
|
|
|
|
xlarge,
|
2017-06-15 19:44:04 +03:00
|
|
|
xlargeUp,
|
|
|
|
breakpoints
|
2017-05-18 21:21:33 +03:00
|
|
|
};
|