enhance(client): tweak MkFolder component

This commit is contained in:
syuilo 2023-03-05 20:28:27 +09:00
parent aa01ba7cce
commit f8ab34734c

View file

@ -1,6 +1,8 @@
<template> <template>
<div ref="rootEl" :class="[$style.root, { [$style.opened]: opened }]"> <div ref="rootEl" :class="$style.root">
<div :class="$style.header" class="_button" @click="toggle"> <MkStickyContainer>
<template #header>
<div :class="[$style.header, { [$style.opened]: opened }]" class="_button" @click="toggle">
<div :class="$style.headerIcon"><slot name="icon"></slot></div> <div :class="$style.headerIcon"><slot name="icon"></slot></div>
<div :class="$style.headerText"> <div :class="$style.headerText">
<div :class="$style.headerTextMain"> <div :class="$style.headerTextMain">
@ -16,7 +18,9 @@
<i v-else class="ti ti-chevron-down icon"></i> <i v-else class="ti ti-chevron-down icon"></i>
</div> </div>
</div> </div>
<div v-if="openedAtLeastOnce" :class="[$style.body, { [$style.bgSame]: bgSame }]" :style="{ maxHeight: maxHeight ? `${maxHeight}px` : null }"> </template>
<div v-if="openedAtLeastOnce" :class="[$style.body, { [$style.bgSame]: bgSame }]" :style="{ maxHeight: maxHeight ? `${maxHeight}px` : null, overflow: maxHeight ? `auto` : null }">
<Transition <Transition
:enter-active-class="$store.state.animation ? $style.transition_toggle_enterActive : ''" :enter-active-class="$store.state.animation ? $style.transition_toggle_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_toggle_leaveActive : ''" :leave-active-class="$store.state.animation ? $style.transition_toggle_leaveActive : ''"
@ -36,6 +40,7 @@
</KeepAlive> </KeepAlive>
</Transition> </Transition>
</div> </div>
</MkStickyContainer>
</div> </div>
</template> </template>
@ -117,12 +122,6 @@ onMounted(() => {
.root { .root {
display: block; display: block;
&.opened {
> .header {
border-radius: 6px 6px 0 0;
}
}
} }
.header { .header {
@ -132,6 +131,8 @@ onMounted(() => {
box-sizing: border-box; box-sizing: border-box;
padding: 9px 12px 9px 12px; padding: 9px 12px 9px 12px;
background: var(--buttonBg); background: var(--buttonBg);
-webkit-backdrop-filter: var(--blur, blur(15px));
backdrop-filter: var(--blur, blur(15px));
border-radius: 6px; border-radius: 6px;
transition: border-radius 0.3s; transition: border-radius 0.3s;
@ -144,6 +145,10 @@ onMounted(() => {
color: var(--accent); color: var(--accent);
background: var(--buttonHoverBg); background: var(--buttonHoverBg);
} }
&.opened {
border-radius: 6px 6px 0 0;
}
} }
.headerUpper { .headerUpper {
@ -202,7 +207,6 @@ onMounted(() => {
background: var(--panel); background: var(--panel);
border-radius: 0 0 6px 6px; border-radius: 0 0 6px 6px;
container-type: inline-size; container-type: inline-size;
overflow: auto;
&.bgSame { &.bgSame {
background: var(--bg); background: var(--bg);