X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/9135a85de4eef32a91c7a3ee0aa405ed454e5a4c..refs/pull/5429/head:/resources/js/components/tri-layout.js diff --git a/resources/js/components/tri-layout.js b/resources/js/components/tri-layout.js index ead2ac3d0..8ccefb06c 100644 --- a/resources/js/components/tri-layout.js +++ b/resources/js/components/tri-layout.js @@ -1,4 +1,4 @@ -import {Component} from "./component"; +import {Component} from './component'; export class TriLayout extends Component { @@ -9,8 +9,8 @@ export class TriLayout extends Component { this.lastLayoutType = 'none'; this.onDestroy = null; this.scrollCache = { - 'content': 0, - 'info': 0, + content: 0, + info: 0, }; this.lastTabShown = 'content'; @@ -19,15 +19,15 @@ export class TriLayout extends Component { // Watch layout changes this.updateLayout(); - window.addEventListener('resize', event => { + window.addEventListener('resize', () => { this.updateLayout(); }, {passive: true}); } updateLayout() { let newLayout = 'tablet'; - if (window.innerWidth <= 1000) newLayout = 'mobile'; - if (window.innerWidth >= 1400) newLayout = 'desktop'; + if (window.innerWidth <= 1000) newLayout = 'mobile'; + if (window.innerWidth >= 1400) newLayout = 'desktop'; if (newLayout === this.lastLayoutType) return; if (this.onDestroy) { @@ -53,20 +53,19 @@ export class TriLayout extends Component { for (const tab of this.tabs) { tab.removeEventListener('click', this.mobileTabClick); } - } + }; } setupDesktop() { // } - /** * Action to run when the mobile info toggle bar is clicked/tapped * @param event */ mobileTabClick(event) { - const tab = event.target.dataset.tab; + const {tab} = event.target.dataset; this.showTab(tab); } @@ -109,4 +108,4 @@ export class TriLayout extends Component { this.lastTabShown = tabName; } -} \ No newline at end of file +}