Skip to content

Commit

Permalink
refactor: optimize header ux
Browse files Browse the repository at this point in the history
  • Loading branch information
supersonictw committed Oct 24, 2024
1 parent 48158e2 commit e169c2b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/components/AppHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
</div>
<app-header-normal />
<app-header-mobile-icon-button
v-if="isMenuItemExist"
class="-mr-2 -my-2 md:hidden"
@click="handleMobileMenuBtnOpenClick"
>
Expand All @@ -29,11 +30,17 @@
</template>

<script setup>
import { ref, onMounted, onUnmounted, provide } from "vue";
import { ref, computed, onMounted, onUnmounted, provide } from "vue";
import { Bars4Icon } from "@heroicons/vue/24/solid"
import { title, subtitle } from "./AppHeaderMenuData.js";
import {
title,
subtitle,
isHomeEnabled,
isSaraEnabled,
menuItems,
} from "./AppHeaderMenuData.js";
import AppHeaderNormal from "./AppHeaderNormal.vue";
import AppHeaderMobile from "./AppHeaderMobile.vue";
Expand All @@ -45,6 +52,10 @@ const isMobileMenuOpened = ref(false);
const parentMenuState = ref(true);
provide("parent-menu-state", parentMenuState);
const isMenuItemExist = computed(() => {
return isSaraEnabled || isHomeEnabled || menuItems.length;
});
const handleMobileMenuBtnOpenClick = () => {
isMobileMenuOpened.value = true;
parentMenuState.value = true;
Expand Down

0 comments on commit e169c2b

Please sign in to comment.