diff --git a/frontend/components/global/Header.vue b/frontend/components/global/Header.vue index 4180758..55a4ff1 100644 --- a/frontend/components/global/Header.vue +++ b/frontend/components/global/Header.vue @@ -3,6 +3,7 @@ import useGetAccount from "~/composables/api/account/useGetAccount"; import { useAuth } from "~/composables/api/auth/useAuth"; +import useGetCategories from "~/composables/api/categories/useGetCategories"; import useGetCartOrders from "~/composables/api/orders/useGetCartOrders"; import { NAV_LINKS } from "~/constants"; @@ -11,16 +12,35 @@ import { NAV_LINKS } from "~/constants"; const route = useRoute(); const { token } = useAuth(); const isSideDrawerOpen = ref(false); +const isCategoriesMenuOpen = ref(false); // queries const { data: account } = useGetAccount(); - const { data: cart } = useGetCartOrders(); +const { data: categories } = useGetCategories(); // computed const isHomePage = computed(() => route.path === "/"); + +const megaMenuCategories = computed(() => { + if (categories.value) { + return categories.value.map((item) => { + return { + title: item.name, + subitems: item.subcategorys.map((item) => { + return { + title: item.name, + link: item.slug, + }; + }), + }; + }); + } + + return []; +}); diff --git a/frontend/components/global/MegaMenu.vue b/frontend/components/global/MegaMenu.vue new file mode 100644 index 0000000..b428108 --- /dev/null +++ b/frontend/components/global/MegaMenu.vue @@ -0,0 +1,138 @@ + + +