| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271 |
- <!--
- Menu Navigation
- -->
- <template>
- <!-- Navigation (écran large) -->
- <div v-if="mdAndUp">
- <LayoutNavigationTopbar />
- <v-row class="navigation-lg" style="margin-top: 0 !important;">
- <!-- Logo Opentalent -->
- <v-col cols="3">
- <nuxt-link to="/">
- <v-img class="logo" src="/images/logo/navigation-logo.png" />
- </nuxt-link>
- </v-col>
- <!-- Menu principal -->
- <v-col cols="9">
- <v-menu
- v-for="item in menu"
- :key="item.label"
- open-on-hover
- >
- <template v-slot:activator="{ props }">
- <nuxt-link
- v-bind="props"
- class="menuItem first-level"
- :to="item.to"
- >
- {{ item.label }}
- </nuxt-link>
- </template>
- <v-list
- v-if="item.children?.length > 0"
- class="menu-list"
- >
- <v-list-item
- v-for="child in item.children"
- :key="child.label"
- :to="child.to"
- class="menuItem"
- >
- <v-list-item-title>{{ child.label }}</v-list-item-title>
- </v-list-item>
- </v-list>
- </v-menu>
- </v-col>
- </v-row>
- </div>
- <!-- Navigation (petit écran) -->
- <v-app
- v-else
- class="navigation-sm"
- >
- <!-- Top bar -->
- <v-app-bar app>
- <v-app-bar-nav-icon
- @click="toggleMenu"
- />
- <nuxt-link to="/">
- <v-img class="logo-md" src="/images/logo/navigation-logo.png" />
- </nuxt-link>
- <nuxt-link
- to="https://admin.opentalent.fr/#/login/"
- style="text-decoration: none"
- >
- <v-btn text>
- <v-icon left class="fas fa-user icon"></v-icon>
- </v-btn>
- </nuxt-link>
- <v-btn text>
- <v-icon left class="fas fa-phone icon"></v-icon>
- </v-btn>
- <nuxt-link to="/agenda-culturel" style="text-decoration: none">
- <v-btn text>
- <v-icon left class="fas fa-calendar icon"></v-icon>
- </v-btn>
- </nuxt-link>
- </v-app-bar>
- <!-- Tiroir de navigation principal -->
- <v-navigation-drawer
- v-model="isMenuOpen"
- app
- temporary
- >
- <v-list nav dense>
- <v-list-item
- v-if="isSubMenu"
- class="menuItem back-item"
- @click="onBackItemClick"
- >
- <v-list-item-title>
- <v-icon icon="fas fa-caret-left" class="mr-1"/> Retour
- </v-list-item-title>
- </v-list-item>
- <v-list-item
- v-for="(item, index) in activeMenu"
- :key="item.label"
- :to="item.to"
- class="menuItem"
- @click="onMenuItemClick(index, item)"
- >
- <v-list-item-title>
- {{ item.label }}
- </v-list-item-title>
- </v-list-item>
- </v-list>
- </v-navigation-drawer>
- </v-app>
- </template>
- <script setup lang="ts">
- import { useDisplay } from "vuetify";
- import type { MainMenuItem } from "~/types/interface";
- const { mdAndUp } = useDisplay();
- const menu: Array<MainMenuItem> = [
- {
- label: "Nos logiciels",
- children: [
- { label: "Opentalent Artist", to: "/opentalent_artist" },
- { label: "Opentalent School", to: "/opentalent_school" },
- { label: "Opentalent Manager", to: "/opentalent_manager" },
- ]
- },
- {
- label: "Nos services",
- children: [
- { label: "Formations", to: "/formations" },
- { label: "Webinaires", to: "/webinaires" },
- ]
- },
- {
- label: "À propos",
- children: [
- { label: "Qui sommes-nous", to: "/qui-sommes-nous" },
- { label: "Nous rejoindre", to: "/nous-rejoindre" },
- ]
- },
- { label: "Actualités", to: "/actualites" },
- { label: "Contact", to: "/nous-contacter" },
- ]
- // Menu dépliant (petit écran)
- const isMenuOpen: Ref<boolean> = ref(false);
- const toggleMenu = () => {
- isMenuOpen.value = !isMenuOpen.value;
- };
- const activeMenuIndex: Ref<number | null> = ref(null)
- const activeMenu = computed(() =>
- activeMenuIndex.value !== null ? menu[activeMenuIndex.value].children : menu
- )
- /**
- * Determines if the is active menu is a sub-menu .
- *
- * @function isSubMenu
- * @returns {boolean} - True if a sub-menu is active, otherwise false.
- */
- const isSubMenu = computed(() => activeMenuIndex.value !== null)
- /**
- * Handles the click event on a menu item.
- *
- * @param {number} index - The index of the clicked menu item.
- * @param {MainMenuItem} item - The clicked menu item.
- * @returns {void}
- */
- const onMenuItemClick = (index: number, item: MainMenuItem): void => {
- if (!item.children) {
- return
- }
- withAnimation(() => activeMenuIndex.value = index)
- }
- /**
- * Function to handle back button click event.
- */
- const onBackItemClick = (): void => {
- withAnimation(() => activeMenuIndex.value = null)
- }
- /**
- * Déclenche une animation de changement de menu en fermant et rouvrant le drawer
- * @param callback
- */
- const withAnimation = (callback: () => void) => {
- isMenuOpen.value = false
- callback()
- setTimeout(() => {isMenuOpen.value = true}, 85)
- }
- </script>
- <style scoped>
- .logo {
- height: 8rem;
- }
- .logo-md {
- width: 150px;
- height: 300px;
- }
- .icon {
- color: #000000;
- }
- .menuItem, .menuItem .v-list-item-title {
- font-family: "Barlow", serif;
- font-style: normal;
- font-weight: 500;
- font-size: 0.9rem;
- letter-spacing: 0.1em;
- text-transform: uppercase;
- color: #0e2d32;
- cursor: pointer;
- text-decoration: none !important;
- }
- /**
- Navigation grands écrans
- */
- .navigation-lg {
- display: flex;
- align-items: center;
- background-color: #ffffff;
- .menuItem {
- padding: 18px;
- }
- .menuItem.first-level {
- font-size: 1rem;
- margin-right: 1rem;
- font-weight: 700;
- letter-spacing: 0.05em;
- }
- }
- /**
- Navigation petits écrans
- */
- .navigation-sm {
- background-color: #ffffff;
- position: fixed;
- top: 0;
- }
- .back-item {
- border-bottom: solid 1px darkgray;
- border-radius: 0;
- .v-list-item-title {
- display: flex;
- align-items: center;
- }
- }
- </style>
|