Skip to content

Commit 4b19c91

Browse files
fix: webvitals CLS MenuNavigationBlock.vue
1 parent ce8218d commit 4b19c91

File tree

1 file changed

+61
-34
lines changed

1 file changed

+61
-34
lines changed

src/templates/menunavigationblock/MenuNavigationBlock.vue

Lines changed: 61 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,91 @@
11
<template>
2-
<div :class="[{'px-container' : isContainer }]">
3-
<Menubar :model="mappedData" class="w-full border-none hidden lg:flex gap-5" :pt="{
4-
root: {
5-
class: 'surface-ground'
6-
},
7-
submenu: {
8-
class: 'rounded-md w-max max-w-xs'
9-
}
10-
}">
2+
<!-- Desk -->
3+
<div class="!min-h-[56px]" :class="[{'px-container' : isContainer }]">
4+
<Menubar
5+
class="w-full border-none hidden lg:flex gap-5"
6+
:model="mappedData"
7+
:pt="{
8+
root: {
9+
class: 'surface-ground'
10+
},
11+
submenu: {
12+
class: 'rounded-md w-max max-w-xs'
13+
}
14+
}"
15+
>
1116
<template #start>
12-
<p class="text-lg font-medium leading-relaxed">{{ menuTitle }}</p>
17+
<p class="text-lg font-medium leading-relaxed !min-h-[56px] flex items-center">
18+
{{ menuTitle }}
19+
</p>
1320
</template>
21+
1422
<template #item="{ item, hasSubmenu, root }">
1523
<template v-if="item.url">
16-
<a class="flex align-items-center p-3 leading-relaxed cursor-pointer" :href="item.url">
17-
<span class="text-sm">{{ item.label }}</span>
24+
<a class="flex align-items-center p-3 leading-relaxed cursor-pointer !min-h-[44px]" :href="item.url">
25+
<span class="text-sm">
26+
{{ item.label }}
27+
</span>
1828
</a>
1929
</template>
2030
<template v-else>
21-
<a class="flex align-items-center p-3 leading-relaxed cursor-pointer">
22-
<span class="text-sm">{{ item.label }}</span>
23-
<i v-if="hasSubmenu"
24-
:class="['pi pi-angle-down', { 'pi-angle-down ml-2': root, 'pi-angle-right ml-auto': !root }]"></i>
31+
<a class="flex align-items-center p-3 leading-relaxed cursor-pointer !min-h-[44px]">
32+
<span class="text-sm">
33+
{{ item.label }}
34+
</span>
35+
<i
36+
v-if="hasSubmenu"
37+
:class="['pi pi-angle-down', { 'pi-angle-down ml-2': root, 'pi-angle-right ml-auto': !root }]"
38+
>
39+
</i>
2540
</a>
2641
</template>
2742
</template>
2843
</Menubar>
2944
</div>
30-
<PanelMenu :model="mobile" class="block lg:hidden" :pt="{
31-
root: {
32-
class: 'w-full',
33-
},
34-
headerContent: {
35-
class: 'w-full border-none py-1 flex items-center min-h-8 text-sm',
36-
},
37-
menuContent: {
38-
class: 'border-none text-sm',
39-
}
40-
}">
45+
46+
<!-- Mobile -->
47+
<PanelMenu
48+
class="block lg:hidden"
49+
:model="mobile"
50+
:pt="{
51+
root: {
52+
class: 'w-full',
53+
},
54+
headerContent: {
55+
class: 'w-full border-none py-1 flex items-center min-h-8 text-sm',
56+
},
57+
menuContent: {
58+
class: 'border-none text-sm',
59+
}
60+
}"
61+
>
4162
<template #item="{ item }">
4263
<template v-if="item.url">
43-
<a class="flex align-items-center cursor-pointer text-color px-3 py-2 w-full"
44-
:href="item.url" target="_self">
45-
<span class="ml-2">{{ item.label }}</span>
64+
<a
65+
class="flex align-items-center cursor-pointer text-color px-3 py-2 w-full"
66+
:href="item.url" target="_self"
67+
>
68+
<span class="ml-2">
69+
{{ item.label }}
70+
</span>
4671
</a>
4772
</template>
4873
<template v-else>
4974
<a class="flex align-items-center cursor-pointer text-color px-3 py-2 w-full" target="_self">
50-
<span class="ml-2">{{ item.label }}</span>
51-
<span v-if="item.items" class="pi pi-angle-down text-primary ml-auto" />
75+
<span class="ml-2">
76+
{{ item.label }}
77+
</span>
78+
<span v-if="item.items" class="pi pi-angle-down text-primary ml-auto"></span>
5279
</a>
5380
</template>
5481
</template>
5582
</PanelMenu>
5683
</template>
5784

5885
<script setup>
59-
import Menubar from 'primevue/menubar';
60-
import PanelMenu from 'primevue/panelmenu';
6186
import { onBeforeMount, ref } from 'vue'
87+
import Menubar from 'primevue/menubar'
88+
import PanelMenu from 'primevue/panelmenu'
6289
6390
const props = defineProps({
6491
menuTitle: {

0 commit comments

Comments
 (0)