Navigation.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <!--
  2. Menu Navigation
  3. -->
  4. <template>
  5. <div v-intersect="onIntersect">
  6. <!-- Navigation (écran large) -->
  7. <div v-if="lgAndUp || (isLargeScreen && !nuxtReady)">
  8. <LayoutNavigationLg :menu="menu" />
  9. </div>
  10. <!-- Navigation (petit écran) -->
  11. <div v-else>
  12. <LayoutNavigationMd :menu="menu" />
  13. </div>
  14. </div>
  15. </template>
  16. <script setup lang="ts">
  17. import { useDisplay } from 'vuetify'
  18. import type { MainMenuItem } from '~/types/interface'
  19. import { useLayoutStore } from '~/stores/layoutStore'
  20. // Get the initial width (useDisplay won't work during SSR)
  21. const isLargeScreen =
  22. ((typeof window === 'undefined' && 1024) ||
  23. window.innerWidth ||
  24. document.documentElement.clientWidth ||
  25. document.body.clientWidth) >= 1280
  26. // On force la version écran large au build côté serveur si l'écran fait plus de 1280px de large
  27. const nuxtReady = ref(false)
  28. onNuxtReady(() => {
  29. nuxtReady.value = true
  30. })
  31. const { lgAndUp } = useDisplay()
  32. const menu: Array<MainMenuItem> = [
  33. {
  34. label: 'Nos logiciels',
  35. children: [
  36. { label: 'Opentalent Artist', to: '/opentalent_artist' },
  37. { label: 'Opentalent School', to: '/opentalent_school' },
  38. { label: 'Opentalent Manager', to: '/opentalent_manager' },
  39. ],
  40. },
  41. {
  42. label: 'Nos services',
  43. children: [
  44. { label: 'Formations', to: '/formations' },
  45. { label: 'Webinaires', to: '/webinaires' },
  46. ],
  47. },
  48. {
  49. label: 'À propos',
  50. children: [
  51. { label: 'Qui sommes-nous', to: '/qui-sommes-nous' },
  52. { label: 'Nous rejoindre', to: '/nous-rejoindre' },
  53. ],
  54. },
  55. { label: 'Actualités', to: '/actualites' },
  56. { label: 'Contact', to: '/nous-contacter' },
  57. ]
  58. const layoutStore = useLayoutStore()
  59. const onIntersect = (isIntersecting: boolean) => {
  60. layoutStore.setIsHeaderVisible(isIntersecting)
  61. }
  62. </script>
  63. <style scoped></style>