1
0
mirror of https://github.com/robonen/lorem-blog.git synced 2026-03-20 10:54:38 +00:00

feat(navigation): update NavigationMenu component structure and improve props definition

This commit is contained in:
2025-06-15 15:40:25 +07:00
parent 7eb1528a55
commit 8e408ead25
4 changed files with 23 additions and 24 deletions

View File

@@ -11,8 +11,8 @@ const items = [
<template>
<header class="p-4 dark bg-background text-foreground">
<div class="mx-auto container flex space-x-18">
<Logo class="h-6" aria-label="Logo" />
<NavigationMenu :items />
<Logo class="h-6" aria-label="Логотип" />
<NavigationMenu :items class="hidden lg:block" />
</div>
</header>
</template>

View File

@@ -1,29 +1,24 @@
<script lang="ts">
import type { NavigationMenuItem } from './types';
export interface NavigationMenuProps {
items: NavigationMenuItem[];
}
</script>
<script setup lang="ts">
import type { NavigationMenuProps } from './types';
import { RouterLink } from 'vue-router';
const { items } = defineProps<NavigationMenuProps>();
</script>
<template>
<ul class="flex items-center space-x-4">
<li v-for="item in items" :key="item.name">
<slot :item>
<RouterLink
class="p-2 rounded-md text-sm font-semibold transition-colors"
active-class="text-primary bg-primary/10"
:to="item.path"
>
{{ item.name }}
</RouterLink>
</slot>
</li>
</ul>
<nav>
<ul class="flex items-center space-x-4">
<li v-for="item in items" :key="item.name">
<slot :item>
<RouterLink
class="p-2 rounded-md font-semibold transition-colors"
active-class="text-primary bg-primary/10"
:to="item.path"
>
{{ item.name }}
</RouterLink>
</slot>
</li>
</ul>
</nav>
</template>

View File

@@ -1,2 +1,2 @@
export { default as NavigationMenu } from './NavigationMenu.vue';
export * from './types';
export { default as NavigationMenu } from './NavigationMenu.vue';

View File

@@ -4,3 +4,7 @@ export interface NavigationMenuItem {
name: string;
path: RouteLocationRaw;
}
export interface NavigationMenuProps {
items: NavigationMenuItem[];
}