@@ -3,7 +3,12 @@ const { links, item } = defineProps<Props>()
3
3
4
4
const currentPath = computed (() => useRoute ().path )
5
5
6
- const today = new Date ().getDate ()
6
+ const today = computed (() => {
7
+ const date = new Date ()
8
+ const month = date .getMonth ()
9
+ // Only show date during December, otherwise show 1
10
+ return month === 11 ? date .getDate () : 1
11
+ })
7
12
8
13
interface TMenuItem {
9
14
title: string
@@ -23,36 +28,26 @@ interface Props {
23
28
</script >
24
29
25
30
<template >
26
- <li
27
- class =" nav-link hover:bg-white/10 rounded-md hover:dark:text-white " :class =" [
28
- { 'nav-link-dropdown': links[item].children },
29
- links[item].class,
30
- currentPath.includes(links[item].href) ? 'dark:text-white' : 'text-verse-700 dark:text-verse-300',
31
- ]"
32
- :aria-haspopup =" links[item].title === 'About' ? 'true' : undefined"
33
- >
34
- <NuxtLink
35
- :class =" [links[item].title === 'Advent Calendar' && 'hidden md:flex text-red-600 dark:text-green-500']"
31
+ <li class =" nav-link hover:bg-white/10 rounded-md hover:dark:text-white " :class =" [
32
+ { 'nav-link-dropdown': links[item].children },
33
+ links[item].class,
34
+ currentPath.includes(links[item].href) ? 'dark:text-white' : 'text-verse-700 dark:text-verse-300',
35
+ ]" :aria-haspopup =" links[item].title === 'About' ? 'true' : undefined" >
36
+ <NuxtLink :class =" [links[item].title === 'Advent Calendar' && 'hidden md:flex text-red-600 dark:text-green-500']"
36
37
class =" flex items-center" :href =" links[item].href"
37
- :target =" !!links[item].href.includes(" ; https" ; ) ? " ; _blank" ; : " ; _self" ; "
38
- >
39
- <span
40
- v-if =" currentPath.includes(links[item].href)" :style =" vTransitionName('menu-border', 'global')"
41
- class =" absolute bottom-0 left-0 right-0 h-1 rounded-full bg-verse-700 dark:bg-verse-100"
42
- />
38
+ :target =" !!links[item].href.includes(" ; https" ; ) ? " ; _blank" ; : " ; _self" ; " >
39
+ <span v-if =" currentPath.includes(links[item].href)" :style =" vTransitionName('menu-border', 'global')"
40
+ class =" absolute bottom-0 left-0 right-0 h-1 rounded-full bg-verse-700 dark:bg-verse-100" />
43
41
44
42
<span class =" relative z-20 p-2" >{{ links[item].title }}</span >
45
43
46
44
<Icon v-if =" !!links[item].href.includes(" ; https" ; )" name =" carbon:launch" height =" 1em" />
47
45
</NuxtLink >
48
46
49
- <NuxtLink
50
- v-if =" links[item].title === 'Advent Calendar'" class =" md:hidden text-green-600 relative flex justify-center items-center animate-bounce"
51
- :href =" links[item].href"
52
-
53
- :target =" !!links[item].href.includes(" ; https" ; ) ? " ; _blank" ; : " ; _self" ; "
54
- >
55
- <IconCalendar class =" w-8 h-8" />
47
+ <NuxtLink v-if =" links[item].title === 'Advent Calendar'"
48
+ class =" md:hidden text-green-600 relative flex justify-center items-center animate-bounce" :href =" links[item].href"
49
+ :target =" !!links[item].href.includes(" ; https" ; ) ? " ; _blank" ; : " ; _self" ; " >
50
+ <Icon name =" carbon:calendar" class =" w-8 h-8" />
56
51
<div class =" text-xs text-red-600 dark:text-red-100 absolute top-1/3 " >
57
52
{{ today }}
58
53
</div >
@@ -62,21 +57,14 @@ interface Props {
62
57
<ul class =" flex flex-col gap-2" >
63
58
<template v-for =" submenu in links [item ].children " :key =" submenu " >
64
59
<li class:list =" [submenu.class]" >
65
- <NuxtLink
66
- :href =" submenu.href"
60
+ <NuxtLink :href =" submenu.href"
67
61
:target =" !!submenu.href.includes(" ; https" ; ) ? " ; _blank" ; : " ; _self" ; "
68
- class =" hover:bg-verse-100 rounded-md block p-2"
69
- >
62
+ class =" hover:bg-verse-100 rounded-md block p-2" >
70
63
<div class =" flex items-center gap-2" >
71
- <div
72
- class =" whitespace-nowrap"
73
- >
64
+ <div class =" whitespace-nowrap" >
74
65
{{ submenu.title }}
75
66
</div >
76
- <Icon
77
- v-if =" !!submenu.href.includes(" ; https" ; )" name =" carbon:launch"
78
- class =" w-4 h-4"
79
- />
67
+ <Icon v-if =" !!submenu.href.includes(" ; https" ; )" name =" carbon:launch" class =" w-4 h-4" />
80
68
</div >
81
69
</NuxtLink >
82
70
</li >
@@ -89,30 +77,30 @@ interface Props {
89
77
90
78
<style scoped lang="postcss">
91
79
.nav-link {
92
- position : relative;
93
-
94
- &:focus-within ,
95
- &:hover {
80
+ position : relative;
96
81
97
- .menu-dropdown {
98
- display : block;
99
- opacity : 1 ;
100
- clip-path : circle (100 % );
101
- transform : translateY (0 px );
102
- padding-top : 7 px ;
103
- transform-origin : left -100 px ;
104
- }
105
- }
82
+ &:focus-within ,
83
+ &:hover {
106
84
107
85
.menu-dropdown {
108
- position : absolute;
109
- left : 0 ;
110
- top : 100 % ;
111
- clip-path : circle (0 % );
112
- /* left: 50%; */
113
- opacity : 0 ;
114
- transform : translateY (-5 px );
115
- transition : 0.2 s ease;
86
+ display : block;
87
+ opacity : 1 ;
88
+ clip-path : circle (100 % );
89
+ transform : translateY (0 px );
90
+ padding-top : 7 px ;
91
+ transform-origin : left -100 px ;
116
92
}
93
+ }
94
+
95
+ .menu-dropdown {
96
+ position : absolute;
97
+ left : 0 ;
98
+ top : 100 % ;
99
+ clip-path : circle (0 % );
100
+ /* left: 50%; */
101
+ opacity : 0 ;
102
+ transform : translateY (-5 px );
103
+ transition : 0.2 s ease;
104
+ }
117
105
}
118
106
</style >
0 commit comments