summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/breakpoints.js
blob: 93aacba0e8e2ea9a9cac3a4a47a1ab81a03bfbd0 (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;