From bfec8255ff06e5f8d0fec421f135bacae17456f9 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Thu, 4 Jul 2024 09:53:16 +0000 Subject: [PATCH] feat: mini-drawer --- src/components/DrawerComponent.vue | 125 +++++++++++++++++------------ src/layouts/MainLayout.vue | 13 +-- 2 files changed, 81 insertions(+), 57 deletions(-) diff --git a/src/components/DrawerComponent.vue b/src/components/DrawerComponent.vue index 4fcd3d10..c010d1af 100644 --- a/src/components/DrawerComponent.vue +++ b/src/components/DrawerComponent.vue @@ -3,6 +3,10 @@ import { computed, ref } from 'vue'; import { useRouter } from 'vue-router'; import { Icon } from '@iconify/vue'; +defineProps<{ + mini?: boolean; +}>(); + const router = useRouter(); const currentRoute = ref(''); @@ -79,7 +83,7 @@ const labelMenu = ref< ]); const leftDrawerOpen = defineModel('leftDrawerOpen', { - default: false, + default: true, }); function navigateTo(label: string, destination: string) { @@ -96,30 +100,33 @@ function branchSetting() {} v-model="leftDrawerOpen" side="left" :breakpoint="599" - :width="$q.screen.lt.sm ? $q.screen.width - 16 : 256" class="column justify-between no-wrap" + :width="mini ? 110 : 256" > -
+ +
-
+
- - -
- +
+ + {{ $t(v.label) }} - - + +
+ +
+ {{ $t(v.label) }} +
-
-
- - -
- +
+ + +
+ -
- - {{ 'ชื่อสาขาที่ 1' }} - - - {{ 'BR1001' }} - -
+
+ + {{ 'ชื่อสาขาที่ 1' }} + + + {{ 'BR1001' }} +
+ + style="margin-left: auto" + />
@@ -188,7 +207,22 @@ function branchSetting() {} // border-left: 10px solid $secondary; } +#drawer-menu :deep(.q-item.active)::before { + display: block; + position: absolute; + content: ' '; + background: var(--brand-2); + border-radius: 99rem; + width: 6px; + left: -0.6rem; + top: 18%; + bottom: 18%; + cursor: context-menu; +} + :deep(.q-drawer) { + transition: 0.1s width ease-in-out; + background-color: var(--surface-0); padding: var(--size-4); padding-right: 0; @@ -199,19 +233,6 @@ function branchSetting() {} background: var(--surface-1); } -#drawer-menu :deep(.q-item.active)::before { - display: block; - position: absolute; - content: ' '; - background: var(--brand-2); - border-radius: 99rem; - width: 6px; - left: -5%; - top: 18%; - bottom: 18%; - cursor: context-menu; -} - .dot { height: 10px; width: 10px; diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 975dc3ab..41b07557 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -169,22 +169,25 @@ onMounted(async () => {