fix order of expansion, WIP hiding headers

This commit is contained in:
Henry Jameson 2025-11-20 20:10:20 +02:00
commit 7d1799e929
6 changed files with 47 additions and 7 deletions

View file

@ -75,7 +75,8 @@ const SettingsModalContent = {
}, },
data () { data () {
return { return {
navCollapsed: false navCollapsed: false,
childCollapsed: false
} }
}, },
methods: { methods: {
@ -96,10 +97,14 @@ const SettingsModalContent = {
}, },
nestedTooBig () { nestedTooBig () {
this.navCollapsed = false this.navCollapsed = false
this.childCollapsed = this.$refs.generalTab.getNavMode()
console.log(this.navCollapsed, this.childCollapsed)
this.$refs.tabSwitcher.showNav() this.$refs.tabSwitcher.showNav()
}, },
nestedTooSmall () { nestedTooSmall () {
this.navCollapsed = true this.navCollapsed = true
this.childCollapsed = this.$refs.generalTab.getNavMode()
console.log(this.navCollapsed, this.childCollapsed)
this.$refs.tabSwitcher.hideNav() this.$refs.tabSwitcher.hideNav()
} }
}, },

View file

@ -3,6 +3,7 @@
ref="tabSwitcher" ref="tabSwitcher"
class="settings_tab-switcher" class="settings_tab-switcher"
:scrollable-tabs="true" :scrollable-tabs="true"
:child-collapsed="childCollapsed"
:body-scroll-lock="bodyLock" :body-scroll-lock="bodyLock"
> >
<div <div
@ -13,6 +14,7 @@
> >
<GeneralTab <GeneralTab
class="inner-tab -middle" class="inner-tab -middle"
ref="generalTab"
:parent-collapsed="navCollapsed" :parent-collapsed="navCollapsed"
@too-small="() => nestedTooSmall()" @too-small="() => nestedTooSmall()"
@too-big="() => nestedTooBig()" @too-big="() => nestedTooBig()"
@ -27,6 +29,7 @@
> >
<AppearanceTab <AppearanceTab
class="inner-tab -middle" class="inner-tab -middle"
:parent-collapsed="navCollapsed"
@too-small="() => nestedTooSmall()" @too-small="() => nestedTooSmall()"
@too-big="() => nestedTooBig()" @too-big="() => nestedTooBig()"
/> />

View file

@ -136,6 +136,15 @@ const GeneralTab = {
this.$store.dispatch('settingsSaved', { error }) this.$store.dispatch('settingsSaved', { error })
}) })
}, },
tooSmall () {
this.$emit('tooSmall')
},
tooBig () {
this.$emit('tooBig')
},
getNavMode () {
return this.$refs.tabSwitcher.getNavMode()
},
clearAssetCache () { clearAssetCache () {
this.clearCache(cacheKey) this.clearCache(cacheKey)
}, },

View file

@ -4,8 +4,8 @@
ref="tabSwitcher" ref="tabSwitcher"
class="settings_tab-switcher" class="settings_tab-switcher"
:parent-collapsed="parentCollapsed" :parent-collapsed="parentCollapsed"
@too-small="() => $emit('tooSmall')" @too-small="tooSmall"
@too-big="() => $emit('tooBig')" @too-big="tooBig"
> >
<div <div
:label="$t('settings.behavior')" :label="$t('settings.behavior')"

View file

@ -37,6 +37,11 @@ export default {
required: false, required: false,
type: Boolean, type: Boolean,
default: false default: false
},
childCollapsed: {
required: false,
type: Boolean,
default: false
} }
}, },
emits: ['tooBig', 'tooSmall'], emits: ['tooBig', 'tooSmall'],
@ -44,7 +49,8 @@ export default {
return { return {
active: findFirstUsable(this.slots()), active: findFirstUsable(this.slots()),
resizeHandler: null, resizeHandler: null,
navMode: false navMode: false,
navSide: 'content'
} }
}, },
computed: { computed: {
@ -103,7 +109,7 @@ export default {
this.$emit('tooSmall') this.$emit('tooSmall')
} }
} else if (contentsWidth - navWidth >= tabContentWidth){ } else if (contentsWidth - navWidth >= tabContentWidth){
if (this.parentCollapsed) { if (!this.navMode) {
this.$emit('tooBig') this.$emit('tooBig')
} else { } else {
this.showNav() this.showNav()
@ -122,12 +128,16 @@ export default {
this.onSwitch.call(null, this.slots()[index].key) this.onSwitch.call(null, this.slots()[index].key)
} }
this.active = index this.active = index
this.navSide = 'content'
}, },
showNav () { showNav () {
this.navMode = false this.navMode = false
}, },
hideNav () { hideNav () {
this.navMode = true this.navMode = true
},
getNavMode () {
return this.navMode
} }
}, },
render () { render () {
@ -173,8 +183,13 @@ export default {
? slot ? slot
: '' : ''
const headerClasses = ['tab-content-label']
if (this.childCollapsed) {
headerClasses.push('-hidden')
}
const header = ( const header = (
<h1 class="tab-content-label"> <h1 class={headerClasses}>
<button type="button" onClick={() => this.navSide = 'tabs'}>LOL</button>
{props.label} {props.label}
</h1> </h1>
) )
@ -192,7 +207,11 @@ export default {
const rootClasses = ['vertical-tab-switcher'] const rootClasses = ['vertical-tab-switcher']
if (this.navMode) { if (this.navMode) {
rootClasses.push('-nav-mode') rootClasses.push('-nav-mode')
rootClasses.push('-nav-content') if (this.navSide === 'content') {
rootClasses.push('-nav-content')
} else {
rootClasses.push('-nav-tabs')
}
} }
return ( return (

View file

@ -85,6 +85,10 @@
> .tab-content-wrapper { > .tab-content-wrapper {
> .tab-content-label { > .tab-content-label {
display: block; display: block;
&.-hidden {
display: none;
}
} }
} }
} }