small refactoring to uncouple tab-switcher from settings modal

This commit is contained in:
Henry Jameson 2021-04-18 15:39:06 +03:00
parent b0789fd6fd
commit 33777fab47
3 changed files with 14 additions and 4 deletions

View file

@ -53,6 +53,9 @@ const SettingsModalContent = {
}, },
open () { open () {
return this.$store.state.interface.settingsModalState !== 'hidden' return this.$store.state.interface.settingsModalState !== 'hidden'
},
bodyLock () {
return this.$store.state.interface.settingsModalState === 'visible'
} }
}, },
methods: { methods: {

View file

@ -4,6 +4,7 @@
class="settings_tab-switcher" class="settings_tab-switcher"
:side-tab-bar="true" :side-tab-bar="true"
:scrollable-tabs="true" :scrollable-tabs="true"
:body-scroll-lock="bodyLock"
> >
<div <div
:label="$t('settings.general')" :label="$t('settings.general')"

View file

@ -33,6 +33,11 @@ export default {
required: false, required: false,
type: Boolean, type: Boolean,
default: false default: false
},
bodyScrollLock: {
required: false,
type: Boolean,
default: false
} }
}, },
data () { data () {
@ -50,9 +55,6 @@ export default {
return this.active return this.active
} }
}, },
settingsModalVisible () {
return this.settingsModalState === 'visible'
},
...mapState({ ...mapState({
settingsModalState: state => state.interface.settingsModalState settingsModalState: state => state.interface.settingsModalState
}) })
@ -161,7 +163,11 @@ export default {
<div class="tabs"> <div class="tabs">
{tabs} {tabs}
</div> </div>
<div ref="contents" class={'contents' + (this.scrollableTabs ? ' scrollable-tabs' : '')} v-body-scroll-lock={this.settingsModalVisible}> <div
ref="contents"
class={'contents' + (this.scrollableTabs ? ' scrollable-tabs' : '')}
v-body-scroll-lock={this.bodyScrollLock}
>
{contents} {contents}
</div> </div>
</div> </div>