diff options
author | Phil Hughes <me@iamphill.com> | 2017-08-10 16:02:30 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-08-10 16:02:30 +0300 |
commit | 3fc89919a8050b19e068b48abc12ac6a1dbe958a (patch) | |
tree | cfaa31964ebf44b71fca64abd76f01af936a508a /app/assets/javascripts/wikis.js | |
parent | 61033b2d4f7084141a6b8f45e9114ca5e86a73ce (diff) |
removed global use of breakpoint checker
Diffstat (limited to 'app/assets/javascripts/wikis.js')
-rw-r--r-- | app/assets/javascripts/wikis.js | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/app/assets/javascripts/wikis.js b/app/assets/javascripts/wikis.js index 51ed2b4fd15..a0025ddb598 100644 --- a/app/assets/javascripts/wikis.js +++ b/app/assets/javascripts/wikis.js @@ -1,10 +1,7 @@ -/* global Breakpoints */ - -import './breakpoints'; +import bp from './breakpoints'; export default class Wikis { constructor() { - this.bp = Breakpoints.get(); this.sidebarEl = document.querySelector('.js-wiki-sidebar'); this.sidebarExpanded = false; @@ -41,15 +38,15 @@ export default class Wikis { this.renderSidebar(); } - sidebarCanCollapse() { - const bootstrapBreakpoint = this.bp.getBreakpointSize(); + static sidebarCanCollapse() { + const bootstrapBreakpoint = bp.getBreakpointSize(); return bootstrapBreakpoint === 'xs' || bootstrapBreakpoint === 'sm'; } renderSidebar() { if (!this.sidebarEl) return; const { classList } = this.sidebarEl; - if (this.sidebarExpanded || !this.sidebarCanCollapse()) { + if (this.sidebarExpanded || !Wikis.sidebarCanCollapse()) { if (!classList.contains('right-sidebar-expanded')) { classList.remove('right-sidebar-collapsed'); classList.add('right-sidebar-expanded'); |