From 6a55fb131537dbe2e054206480bd8df25a392fab Mon Sep 17 00:00:00 2001 From: phatnguyen Date: Sat, 23 Sep 2023 10:29:39 +0200 Subject: [PATCH 1/3] style: optimize, prepare for update edit dialog --- src/frontend/components/BaseMenuButton.vue | 14 +++++++++-- src/frontend/components/ProjectItem.vue | 28 +++++++++++++++------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/frontend/components/BaseMenuButton.vue b/src/frontend/components/BaseMenuButton.vue index a9b1409..092a4c5 100644 --- a/src/frontend/components/BaseMenuButton.vue +++ b/src/frontend/components/BaseMenuButton.vue @@ -26,7 +26,17 @@ withDefaults(defineProps<{ */ menuClass?: string }>(), { variant: 'ghost', iconOnly: true }) + +const emits = defineEmits<{ + /** + * Triggers when menu is open + * @property {boolean} state current state of menu + */ + (e: 'toggleMenu', state: boolean): void +}>() + const isMenuOpen = ref(false) +watch(isMenuOpen, () => emits('toggleMenu', isMenuOpen.value)) const button = ref() onClickOutside(button, () => isMenuOpen.value = false) @@ -52,8 +62,8 @@ onClickOutside(button, () => isMenuOpen.value = false)