2
2
import {
3
3
chakra ,
4
4
useColorMode ,
5
- useColorModeValue ,
6
5
CHStack ,
7
6
CFlex ,
8
7
CIcon ,
9
8
CIconButton ,
10
- CLink
11
- } from ' @chakra-ui/vue-next'
12
- import { useWindowScroll } from ' @vueuse/core'
13
- import { computed , onMounted , ref } from ' vue'
14
- import SponsorButton from ' ./SponsorButton.vue'
15
- // import { SearchButton } from "./AlgoliaSearch.vue"
16
- // import { MobileNavButton } from "./MobileNav.vue"
17
- import VersionSwitcher from ' ./VersionSwitcher'
18
- import siteConfig from ' @/config/site-config'
9
+ CLink ,
10
+ useColorModeValue
11
+ } from ' @chakra-ui/vue-next' ;
12
+ import { useWindowScroll } from ' @vueuse/core' ;
13
+ import { computed , onMounted , ref } from ' vue' ;
14
+ import SponsorButton from ' ./SponsorButton.server.vue' ;
15
+ import VersionSwitcher from ' ./VersionSwitcher' ;
16
+ import siteConfig from ' @/config/site-config' ;
19
17
20
- const NuxtLink = resolveComponent (' nuxt-link' )
18
+ const NuxtLink = resolveComponent (' nuxt-link' ) as any ;
21
19
22
- const { toggleColorMode } = useColorMode ()
23
- const text = useColorModeValue (' dark' , ' light' )
24
- const switchIcon = useColorModeValue (' moon' , ' sun' )
25
- const bg = useColorModeValue (' white' , ' gray.800' )
20
+ const { colorMode, toggleColorMode } = useColorMode ();
21
+ const headerRef = ref <{ $el: HTMLDivElement } | undefined >(undefined );
26
22
27
- const headerRef = ref <{ $el : HTMLDivElement } | undefined >( undefined )
23
+ const { y } = useWindowScroll ();
28
24
29
- const { y } = useWindowScroll ()
30
-
31
- const height = ref (0 )
25
+ const height = ref (0 );
32
26
33
27
onMounted (() => {
34
- height .value = headerRef .value ?.$el .getBoundingClientRect ().height ?? 0
35
- })
28
+ height .value = headerRef .value ?.$el .getBoundingClientRect ().height ?? 0 ;
29
+ });
36
30
37
31
const headerShadow = computed (() => {
38
- return y .value > height .value ? ' sm' : undefined
39
- })
32
+ return y .value > height .value ? ' sm' : undefined ;
33
+ });
40
34
</script >
41
35
42
36
<template >
@@ -50,10 +44,9 @@ const headerShadow = computed(() => {
50
44
left =" 0"
51
45
right =" 0"
52
46
width =" full"
53
- :bg =" bg"
54
47
backdrop-filter =" saturate(120%) blur(5px)"
55
- border-top = " 6px solid"
56
- border-color =" emerald.500 "
48
+ border-bottom = " 1px solid"
49
+ : border-color =" useColorModeValue('blackAlpha.600', 'whiteAlpha.300').value "
57
50
>
58
51
<chakra .nav height =" 4.5rem" mx =" auto" max-w =" 8xl" >
59
52
<!-- content -->
@@ -72,13 +65,7 @@ const headerShadow = computed(() => {
72
65
</CFlex >
73
66
74
67
<!-- nav -->
75
- <CFlex
76
- justify =" flex-end"
77
- w =" 100%"
78
- max-w =" 1100px"
79
- align =" center"
80
- color =" gray.400"
81
- >
68
+ <CFlex justify =" flex-end" w =" 100%" max-w =" 1100px" align =" center" >
82
69
<!-- <SearchButton></SearchButton> -->
83
70
<VersionSwitcher />
84
71
<CHStack spacing =" 5" :display =" { base: 'none', md: 'flex' }" >
@@ -128,14 +115,16 @@ const headerShadow = computed(() => {
128
115
<CIconButton
129
116
size =" md"
130
117
font-size =" lg"
131
- :aria-label =" `Switch to ${text} mode`"
132
- :title =" `Switch to ${text} mode`"
118
+ aria-label =" Switch color mode"
133
119
variant =" ghost"
120
+ type =" button"
134
121
color =" current"
135
122
:ml =" { base: '0', md: '3' }"
136
- :icon =" switchIcon"
137
123
@click =" toggleColorMode"
138
- />
124
+ >
125
+ <IconsMoonIcon v-if =" colorMode === 'light'" />
126
+ <IconsSunIcon v-else />
127
+ </CIconButton >
139
128
<SponsorButton ml =" 5" />
140
129
<!-- <mobile-nav-button @click="isOpen = true"></mobile-nav-button> -->
141
130
</CFlex >
0 commit comments