debian-mirror-gitlab/app/assets/javascripts/breakpoints.js

23 lines
456 B
JavaScript
Raw Normal View History

2017-09-10 17:25:29 +05:30
export const breakpoints = {
lg: 1200,
md: 992,
sm: 768,
xs: 0,
};
2016-09-13 17:45:13 +05:30
2017-09-10 17:25:29 +05:30
const BreakpointInstance = {
windowWidth: () => window.innerWidth,
getBreakpointSize() {
const windowWidth = this.windowWidth();
2016-09-13 17:45:13 +05:30
2017-09-10 17:25:29 +05:30
const breakpoint = Object.keys(breakpoints).find(key => windowWidth > breakpoints[key]);
2016-09-13 17:45:13 +05:30
2017-09-10 17:25:29 +05:30
return breakpoint;
},
2019-07-07 11:18:12 +05:30
isDesktop() {
return ['lg', 'md'].includes(this.getBreakpointSize());
},
2017-09-10 17:25:29 +05:30
};
2016-09-13 17:45:13 +05:30
2017-09-10 17:25:29 +05:30
export default BreakpointInstance;