Skip to content

Commit 944780b

Browse files
authored
Merge pull request #554 from devforth/feature/AdminForth/1411/add-small-animation-on-openclo
Feature/admin forth/1411/add small animation on openclo
2 parents 376b904 + bb588df commit 944780b

1 file changed

Lines changed: 27 additions & 6 deletions

File tree

adminforth/spa/src/components/Sidebar.vue

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,15 @@
9090
</svg>
9191
</button>
9292

93-
<ul :id="`dropdown-example${i}`" role="none" class="af-sidebar-dropdown pt-1 space-y-1" :class="{ 'hidden': !opened.includes(i) }">
94-
<template v-for="(child, j) in item.children" :key="`menu-${i}-${j}`">
95-
<li class="af-sidebar-menu-link">
96-
<MenuLink :item="child" isChild="true" @click="$emit('hideSidebar')"/>
93+
<transition name="slow-drop">
94+
<ul v-show="opened.includes(i)" :id="`dropdown-example${i}`" role="none" class="af-sidebar-dropdown pt-1 space-y-1 overflow-hidden">
95+
<template v-for="(child, j) in item.children" :key="`menu-${i}-${j}`">
96+
<li class="af-sidebar-menu-link">
97+
<MenuLink :item="child" isChild="true" @click="$emit('hideSidebar')"/>
9798
</li>
98-
</template>
99-
</ul>
99+
</template>
100+
</ul>
101+
</transition>
100102
</li>
101103
<li v-else class="af-sidebar-menu-link">
102104
<MenuLink :item="item" @click="$emit('hideSidebar')"/>
@@ -292,6 +294,25 @@
292294
background-color: rgba(75, 85, 99, 0.4);
293295
}
294296
297+
/* Custom animation for dropdown */
298+
.slow-drop-enter-active,
299+
.slow-drop-leave-active {
300+
overflow: hidden;
301+
transition: opacity 0.2s ease, transform 0.2s ease;
302+
}
303+
304+
.slow-drop-enter-from,
305+
.slow-drop-leave-to {
306+
opacity: 0;
307+
transform: translateY(-4px);
308+
}
309+
310+
.slow-drop-enter-to,
311+
.slow-drop-leave-from {
312+
opacity: 1;
313+
transform: translateY(0);
314+
}
315+
295316
/* For browsers that support overlay scrollbars natively */
296317
@supports (overflow: overlay) {
297318
.sidebar-scroll {

0 commit comments

Comments
 (0)