summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/breakpoints.js
blob: 4d5d6bb864b2d5fc5f6d0a0c6c963fd46e566b9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
export const breakpoints = {
  lg: 1200,
  md: 992,
  sm: 768,
  xs: 0,
};

const BreakpointInstance = {
  windowWidth: () => window.innerWidth,
  getBreakpointSize() {
    const windowWidth = this.windowWidth();

    const breakpoint = Object.keys(breakpoints).find(key => windowWidth > breakpoints[key]);

    return breakpoint;
  },
  isDesktop() {
    return ['lg', 'md'].includes(this.getBreakpointSize);
  },
};

export default BreakpointInstance;