2017-08-10 07:38:45 -04:00
|
|
|
export const breakpoints = {
|
|
|
|
lg: 1200,
|
|
|
|
md: 992,
|
|
|
|
sm: 768,
|
|
|
|
xs: 0,
|
|
|
|
};
|
2016-12-14 00:26:26 -05:00
|
|
|
|
2017-08-10 07:38:45 -04:00
|
|
|
const BreakpointInstance = {
|
|
|
|
windowWidth: () => window.innerWidth,
|
|
|
|
getBreakpointSize() {
|
|
|
|
const windowWidth = this.windowWidth();
|
2016-07-24 16:45:11 -04:00
|
|
|
|
2017-08-10 07:38:45 -04:00
|
|
|
const breakpoint = Object.keys(breakpoints).find(key => windowWidth > breakpoints[key]);
|
2016-07-24 16:45:11 -04:00
|
|
|
|
2017-08-10 07:38:45 -04:00
|
|
|
return breakpoint;
|
|
|
|
},
|
2019-03-28 17:37:06 -04:00
|
|
|
isDesktop() {
|
2019-04-10 16:39:03 -04:00
|
|
|
return ['lg', 'md'].includes(this.getBreakpointSize());
|
2019-03-28 17:37:06 -04:00
|
|
|
},
|
2017-08-10 07:38:45 -04:00
|
|
|
};
|
2016-07-24 16:45:11 -04:00
|
|
|
|
2017-08-10 07:38:45 -04:00
|
|
|
export default BreakpointInstance;
|