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