mirror of
https://github.com/robonen/lorem-blog.git
synced 2026-03-20 02:44:39 +00:00
feat(navigation): update NavigationMenu component structure and improve props definition
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -1,23 +1,17 @@
|
||||
<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>
|
||||
<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 text-sm font-semibold transition-colors"
|
||||
class="p-2 rounded-md font-semibold transition-colors"
|
||||
active-class="text-primary bg-primary/10"
|
||||
:to="item.path"
|
||||
>
|
||||
@@ -26,4 +20,5 @@ const { items } = defineProps<NavigationMenuProps>();
|
||||
</slot>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</template>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export * from './types';
|
||||
export { default as NavigationMenu } from './NavigationMenu.vue';
|
||||
export * from './types';
|
||||
|
||||
@@ -4,3 +4,7 @@ export interface NavigationMenuItem {
|
||||
name: string;
|
||||
path: RouteLocationRaw;
|
||||
}
|
||||
|
||||
export interface NavigationMenuProps {
|
||||
items: NavigationMenuItem[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user