feature: Menu bar component added

This commit is contained in:
Paul Valerie GOMA 2025-07-30 10:44:52 +02:00
parent e46ba8127d
commit 93cd17aef5

View File

@ -0,0 +1,53 @@
<script setup lang="ts">
import Menubar from 'primevue/menubar';
import type IVMenuBar from './IVMenuBar.type';
import type { MenubarSlots } from 'primevue/menubar';
import { computed } from 'vue';
const props = withDefaults(defineProps<IVMenuBar>(), {
searchbarId: 'searchbar-header',
serviceTitle: undefined,
serviceDescription: undefined,
logo: false,
logoText: undefined,
breakpoints: '960px',
quickLinks: undefined,
menuLabel: undefined
})
type VMenuBarSlots = MenubarSlots & {
default?: (props: Record<string, unknown>) => unknown
};
const slots = defineSlots<VMenuBarSlots>();
const menuBarSlotsKeys = [
'start',
'end',
'item',
'button',
'buttonicon',
'submenuicon',
'itemicon'
] as const
const availableSlots = computed(() =>
menuBarSlotsKeys.filter((key) => !!slots[key]).map((key) => [key, slots[key]])
);
</script>
<template>
<Menubar
role="banner"
:model="props.quickLinks"
:breakpoint="props.breakpoints"
>
<template
v-for="([name]) in availableSlots"
:key="name"
v-slot:[name]="slotProps"
>
<slot :name="name" v-bind="slotProps" />
</template>
<slot></slot>
</Menubar>
</template>