11<script setup lang="ts">
2+ import { motion } from ' motion-v'
3+ import logoUrl from ' ~/assets/icons/kms-tools.svg'
4+
25const route = useRoute ()
36
47const { locales, t, setLocale } = useI18n ()
58
9+ const { hidden, hoverLift, press, visible } = useMotionPresets ()
10+
611const localePath = useLocalePath ()
712
813const path = computed (() => route .path .slice (1 ).split (' /' ))
914
15+ const activeSection = computed (() => path .value [0 ] || ' ' )
16+
1017const drawerVisible = ref (false )
1118
1219const navItems = computed (() => [
@@ -50,45 +57,63 @@ function handleNavClick(name: string) {
5057
5158<template >
5259 <ALayoutHeader
53- class =" sticky top-0 z-[100] flex h-20 select-none items-center bg-[--color-bg-2] px-4 shadow-md"
60+ class =" sticky top-0 z-[100] flex h-20 select-none items-center border-b border-white/10 bg-[--color-bg-2]/80 px-4 shadow-md backdrop-blur-xl "
5461 >
5562 <div class =" mx-auto flex w-[72rem] max-w-full items-center justify-between" >
56- <img
57- src =" /assets/icons/kms-tools.svg "
63+ <motion . img
64+ : src =" logoUrl "
5865 alt =" KMS Tools"
5966 class =" h-14 w-auto cursor-pointer"
67+ :initial =" hidden(10)"
68+ :animate =" visible(0.02)"
69+ :whileHover =" { scale: 1.04, rotate: -2 }"
70+ :whilePress =" press"
6071 @click =" navigateTo(localePath('/'))"
6172 />
6273
63- <!-- Desktop Menu -->
64- <AMenu
65- :selected-keys =" path"
66- mode =" horizontal"
67- class =" hidden grow md:flex [& _.arco-menu-overflow-wrap]:text-end [& _.arco-menu-selected-label]:left-4"
68- >
69- <AMenuItem
74+ <nav class =" hidden grow items-center justify-center gap-2 md:flex" >
75+ <motion .button
7076 v-for =" item in navItems"
7177 :key =" item.name"
72- class =" !inline-flex items-center gap-1"
78+ type =" button"
79+ class =" relative flex items-center gap-2 overflow-hidden rounded-full px-4 py-2 text-sm font-medium text-[var(--color-text-2)] transition-colors hover:text-[var(--color-text-1)]"
80+ :initial =" hidden(10)"
81+ :animate =" visible(navItems.findIndex(nav => nav.name === item.name) * 0.05 + 0.08)"
82+ :whileHover =" hoverLift(4, 1.02)"
83+ :whilePress =" press"
7384 @click =" handleNavClick(item.name)"
7485 >
75- <Icon :name =" item.icon" />
76- <span >{{ item.label }}</span >
77- </AMenuItem >
78- </AMenu >
86+ <motion .span
87+ v-if =" activeSection === item.name"
88+ layoutId =" header-nav-pill"
89+ class =" absolute inset-0 rounded-full bg-[rgb(var(--primary-6))]/14 ring-1 ring-[rgb(var(--primary-6))]/20"
90+ />
91+ <span class =" relative z-[1] inline-flex items-center gap-2" >
92+ <Icon :name =" item.icon" />
93+ <span >{{ item.label }}</span >
94+ </span >
95+ </motion .button >
96+ </nav >
7997
8098 <ASpace >
8199 <ADropdown >
82- <AButton size =" small" type =" secondary" >
83- <template #icon >
84- <ClientOnly >
85- <Icon :name =" `icons:${$colorMode.preference}-mode`" />
86- <template #fallback >
87- <Icon :name =" `icons:system-mode`" />
88- </template >
89- </ClientOnly >
90- </template >
91- </AButton >
100+ <motion .div
101+ :initial =" hidden(10)"
102+ :animate =" visible(0.14)"
103+ :whileHover =" hoverLift(3, 1.04)"
104+ :whilePress =" press"
105+ >
106+ <AButton size =" small" type =" secondary" >
107+ <template #icon >
108+ <ClientOnly >
109+ <Icon :name =" `icons:${$colorMode.preference}-mode`" />
110+ <template #fallback >
111+ <Icon :name =" `icons:system-mode`" />
112+ </template >
113+ </ClientOnly >
114+ </template >
115+ </AButton >
116+ </motion .div >
92117 <template #content >
93118 <ADoption
94119 v-for =" item in themeItems"
@@ -103,9 +128,16 @@ function handleNavClick(name: string) {
103128 </template >
104129 </ADropdown >
105130 <ADropdown >
106- <AButton size =" small" type =" secondary" >
107- <template #icon ><Icon name =" icons:languages" /></template >
108- </AButton >
131+ <motion .div
132+ :initial =" hidden(10)"
133+ :animate =" visible(0.18)"
134+ :whileHover =" hoverLift(3, 1.04)"
135+ :whilePress =" press"
136+ >
137+ <AButton size =" small" type =" secondary" >
138+ <template #icon ><Icon name =" icons:languages" /></template >
139+ </AButton >
140+ </motion .div >
109141 <template #content >
110142 <ADoption
111143 v-for =" locale in locales"
@@ -120,16 +152,30 @@ function handleNavClick(name: string) {
120152 </template >
121153 </ADropdown >
122154 <a target =" _blank" href =" https://github.com/ikxin/kms-tools" >
123- <AButton size =" small" type =" secondary" >
124- <template #icon ><Icon name =" icons:github" /></template >
125- </AButton >
155+ <motion .div
156+ :initial =" hidden(10)"
157+ :animate =" visible(0.22)"
158+ :whileHover =" hoverLift(3, 1.04)"
159+ :whilePress =" press"
160+ >
161+ <AButton size =" small" type =" secondary" >
162+ <template #icon ><Icon name =" icons:github" /></template >
163+ </AButton >
164+ </motion .div >
126165 </a >
127166
128167 <!-- Mobile Hamburger -->
129168 <div class =" md:hidden" >
130- <AButton size =" small" type =" secondary" @click =" drawerVisible = true" >
131- <template #icon ><Icon name =" material-symbols:menu" /></template >
132- </AButton >
169+ <motion .div
170+ :initial =" hidden(10)"
171+ :animate =" visible(0.24)"
172+ :whileHover =" hoverLift(3, 1.04)"
173+ :whilePress =" press"
174+ >
175+ <AButton size =" small" type =" secondary" @click =" drawerVisible = true" >
176+ <template #icon ><Icon name =" material-symbols:menu" /></template >
177+ </AButton >
178+ </motion .div >
133179 </div >
134180 </ASpace >
135181 </div >
0 commit comments