1
0
mirror of https://github.com/yldio/copilot.git synced 2025-01-23 17:30:13 +02:00
copilot/ui/src/shared/constants/breakpoints.js

56 lines
1.4 KiB
JavaScript
Raw Normal View History

const styled = require('styled-components');
// github.com/kristoferjoseph/flexboxgrid/blob/master/dist/flexboxgrid.css
const small = {
upper: '48rem'
};
const medium = {
upper: '64rem',
lower: '48.1rem',
};
const large = {
upper: '75rem',
lower: '64.1rem',
};
const xlarge = {
lower: '75.1rem',
};
const screen = 'only screen';
const screens = {
// >= 768px
'smallOnly': `${screen} and (max-width: ${small.upper})`,
'small': `${screen} and (min-width: ${small.upper}})`,
// >= 1024px
2017-02-03 15:27:14 +02:00
'mediumOnly': `${screen} and (min-width: ${medium.lower})
and (max-width: ${medium.upper})`,
2017-02-03 15:27:14 +02:00
'mediumDown': `${screen} and (max-width: ${medium.upper})`,
'medium': `${screen} and (min-width: ${medium.lower})`,
// >= 1200px
2017-02-03 15:27:14 +02:00
'largeOnly': `${screen} and (min-width: ${large.lower})
and (max-width: ${large.upper})`,
2017-02-03 15:27:14 +02:00
'largeDown': `${screen} and (max-width: ${large.upper})`,
'large': `${screen} and (min-width: 75rem)`,
'xlarge': `${screen} and (min-width: ${xlarge.lower})
and (max-width: ${xlarge.upper})`,
2017-02-03 15:27:14 +02:00
'xlargeUp': `${screen} and (min-width: ${xlarge.lower})`,
};
const breakpoints = Object.keys(screens).reduce((acc, label) => {
return {
...acc,
[label]: (...args) => styled.css`
@media ${screens[label]} {
${styled.css(...args)}
}
`
};
}, {});
module.exports = breakpoints;