fix(navbar) : reorder nav groups and add lucide icons
- Reorder: Composants, Pieces, Produits (was Pieces, Produits, Composants) - Add icons to all nav links and dropdown groups - Dashboard, Factory, ClipboardList, Cpu, Puzzle, Package, Link Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -24,9 +24,10 @@
|
|||||||
<li v-for="link in simpleLinks" :key="link.to">
|
<li v-for="link in simpleLinks" :key="link.to">
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
:to="link.to"
|
:to="link.to"
|
||||||
class="rounded-md px-2 py-1 transition-colors"
|
class="rounded-md px-2 py-1 transition-colors flex items-center gap-2"
|
||||||
:class="linkClass(link)"
|
:class="linkClass(link)"
|
||||||
>
|
>
|
||||||
|
<component :is="link.icon" v-if="link.icon" class="w-4 h-4" aria-hidden="true" />
|
||||||
{{ link.label }}
|
{{ link.label }}
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</li>
|
</li>
|
||||||
@@ -46,7 +47,10 @@
|
|||||||
@keydown.enter.prevent="toggleDropdown(group.id + '-mobile')"
|
@keydown.enter.prevent="toggleDropdown(group.id + '-mobile')"
|
||||||
@keydown.space.prevent="toggleDropdown(group.id + '-mobile')"
|
@keydown.space.prevent="toggleDropdown(group.id + '-mobile')"
|
||||||
>
|
>
|
||||||
<span>{{ group.label }}</span>
|
<span class="flex items-center gap-2">
|
||||||
|
<component :is="group.icon" v-if="group.icon" class="w-4 h-4" aria-hidden="true" />
|
||||||
|
{{ group.label }}
|
||||||
|
</span>
|
||||||
<IconLucideChevronRight
|
<IconLucideChevronRight
|
||||||
class="h-4 w-4 transition-transform"
|
class="h-4 w-4 transition-transform"
|
||||||
:class="openDropdown === group.id + '-mobile' ? 'rotate-90' : ''"
|
:class="openDropdown === group.id + '-mobile' ? 'rotate-90' : ''"
|
||||||
@@ -100,9 +104,10 @@
|
|||||||
<li v-for="link in simpleLinks" :key="link.to">
|
<li v-for="link in simpleLinks" :key="link.to">
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
:to="link.to"
|
:to="link.to"
|
||||||
class="transition-colors px-3 py-2 rounded-md"
|
class="transition-colors px-3 py-2 rounded-md flex items-center gap-1.5"
|
||||||
:class="linkClass(link)"
|
:class="linkClass(link)"
|
||||||
>
|
>
|
||||||
|
<component :is="link.icon" v-if="link.icon" class="w-4 h-4" aria-hidden="true" />
|
||||||
{{ link.label }}
|
{{ link.label }}
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</li>
|
</li>
|
||||||
@@ -119,13 +124,14 @@
|
|||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="inline-flex items-center gap-1 rounded-md px-3 py-2 transition-colors"
|
class="inline-flex items-center gap-1.5 rounded-md px-3 py-2 transition-colors"
|
||||||
:class="groupClass(group)"
|
:class="groupClass(group)"
|
||||||
:aria-expanded="openDropdown === group.id + '-desktop'"
|
:aria-expanded="openDropdown === group.id + '-desktop'"
|
||||||
@click="toggleDropdown(group.id + '-desktop')"
|
@click="toggleDropdown(group.id + '-desktop')"
|
||||||
@keydown.enter.prevent="toggleDropdown(group.id + '-desktop')"
|
@keydown.enter.prevent="toggleDropdown(group.id + '-desktop')"
|
||||||
@keydown.space.prevent="toggleDropdown(group.id + '-desktop')"
|
@keydown.space.prevent="toggleDropdown(group.id + '-desktop')"
|
||||||
>
|
>
|
||||||
|
<component :is="group.icon" v-if="group.icon" class="w-4 h-4" aria-hidden="true" />
|
||||||
{{ group.label }}
|
{{ group.label }}
|
||||||
<IconLucideChevronRight
|
<IconLucideChevronRight
|
||||||
class="h-4 w-4 transition-transform"
|
class="h-4 w-4 transition-transform"
|
||||||
@@ -233,7 +239,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, onMounted, onBeforeUnmount } from 'vue'
|
import { ref, computed, onMounted, onBeforeUnmount, type Component } from 'vue'
|
||||||
import { useRoute } from '#imports'
|
import { useRoute } from '#imports'
|
||||||
import { useNavDropdown } from '~/composables/useNavDropdown'
|
import { useNavDropdown } from '~/composables/useNavDropdown'
|
||||||
import { usePermissions } from '~/composables/usePermissions'
|
import { usePermissions } from '~/composables/usePermissions'
|
||||||
@@ -243,6 +249,13 @@ import IconLucideMenu from '~icons/lucide/menu'
|
|||||||
import IconLucideSettings from '~icons/lucide/settings'
|
import IconLucideSettings from '~icons/lucide/settings'
|
||||||
import IconLucideChevronRight from '~icons/lucide/chevron-right'
|
import IconLucideChevronRight from '~icons/lucide/chevron-right'
|
||||||
import IconLucideLogOut from '~icons/lucide/log-out'
|
import IconLucideLogOut from '~icons/lucide/log-out'
|
||||||
|
import IconLucideLayoutDashboard from '~icons/lucide/layout-dashboard'
|
||||||
|
import IconLucideFactory from '~icons/lucide/factory'
|
||||||
|
import IconLucideClipboardList from '~icons/lucide/clipboard-list'
|
||||||
|
import IconLucideCpu from '~icons/lucide/cpu'
|
||||||
|
import IconLucidePuzzle from '~icons/lucide/puzzle'
|
||||||
|
import IconLucidePackage from '~icons/lucide/package'
|
||||||
|
import IconLucideLink from '~icons/lucide/link'
|
||||||
import logoSrc from '~/assets/LOGO_CARRE_BLANC.png'
|
import logoSrc from '~/assets/LOGO_CARRE_BLANC.png'
|
||||||
|
|
||||||
defineEmits<{
|
defineEmits<{
|
||||||
@@ -253,25 +266,38 @@ defineEmits<{
|
|||||||
interface NavLink {
|
interface NavLink {
|
||||||
to: string
|
to: string
|
||||||
label: string
|
label: string
|
||||||
|
icon?: Component
|
||||||
}
|
}
|
||||||
|
|
||||||
interface NavGroup {
|
interface NavGroup {
|
||||||
id: string
|
id: string
|
||||||
label: string
|
label: string
|
||||||
|
icon?: Component
|
||||||
activePaths: string[]
|
activePaths: string[]
|
||||||
children: NavLink[]
|
children: NavLink[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const simpleLinks: NavLink[] = [
|
const simpleLinks: NavLink[] = [
|
||||||
{ to: '/', label: 'Vue d\'ensemble' },
|
{ to: '/', label: 'Vue d\'ensemble', icon: IconLucideLayoutDashboard },
|
||||||
{ to: '/machines', label: 'Parc Machines' },
|
{ to: '/machines', label: 'Parc Machines', icon: IconLucideFactory },
|
||||||
{ to: '/machine-skeleton', label: 'Squelettes de machine' },
|
{ to: '/machine-skeleton', label: 'Squelettes', icon: IconLucideClipboardList },
|
||||||
]
|
]
|
||||||
|
|
||||||
const navGroups: NavGroup[] = [
|
const navGroups: NavGroup[] = [
|
||||||
|
{
|
||||||
|
id: 'component',
|
||||||
|
label: 'Composants',
|
||||||
|
icon: IconLucideCpu,
|
||||||
|
activePaths: ['/component-category', '/component-catalog'],
|
||||||
|
children: [
|
||||||
|
{ to: '/component-catalog', label: 'Catalogue des composants' },
|
||||||
|
{ to: '/component-category', label: 'Catégorie de composant' },
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'pieces',
|
id: 'pieces',
|
||||||
label: 'Pièces',
|
label: 'Pièces',
|
||||||
|
icon: IconLucidePuzzle,
|
||||||
activePaths: ['/piece-category', '/pieces-catalog'],
|
activePaths: ['/piece-category', '/pieces-catalog'],
|
||||||
children: [
|
children: [
|
||||||
{ to: '/pieces-catalog', label: 'Catalogue des pièces' },
|
{ to: '/pieces-catalog', label: 'Catalogue des pièces' },
|
||||||
@@ -281,24 +307,17 @@ const navGroups: NavGroup[] = [
|
|||||||
{
|
{
|
||||||
id: 'products',
|
id: 'products',
|
||||||
label: 'Produits',
|
label: 'Produits',
|
||||||
|
icon: IconLucidePackage,
|
||||||
activePaths: ['/product-category', '/product-catalog'],
|
activePaths: ['/product-category', '/product-catalog'],
|
||||||
children: [
|
children: [
|
||||||
{ to: '/product-catalog', label: 'Catalogue des produits' },
|
{ to: '/product-catalog', label: 'Catalogue des produits' },
|
||||||
{ to: '/product-category', label: 'Catégorie de produit' },
|
{ to: '/product-category', label: 'Catégorie de produit' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
id: 'component',
|
|
||||||
label: 'Composant',
|
|
||||||
activePaths: ['/component-category', '/component-catalog'],
|
|
||||||
children: [
|
|
||||||
{ to: '/component-catalog', label: 'Catalogue des composants' },
|
|
||||||
{ to: '/component-category', label: 'Catégorie de composant' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: 'resources',
|
id: 'resources',
|
||||||
label: 'Ressources liées',
|
label: 'Ressources liées',
|
||||||
|
icon: IconLucideLink,
|
||||||
activePaths: ['/sites', '/documents', '/constructeurs', '/activity-log', '/comments'],
|
activePaths: ['/sites', '/documents', '/constructeurs', '/activity-log', '/comments'],
|
||||||
children: [
|
children: [
|
||||||
{ to: '/sites', label: 'Sites' },
|
{ to: '/sites', label: 'Sites' },
|
||||||
|
|||||||
Reference in New Issue
Block a user