@@ -2,15 +2,14 @@ import React, { useState } from "react"
2
2
import { AnimatePresence , motion } from "framer-motion"
3
3
import { useTranslation } from "next-i18next"
4
4
import { MdChevronRight } from "react-icons/md"
5
- import { Box , Center , HStack , Icon } from "@chakra-ui/react"
6
5
7
6
import type { ChildOnlyProp , TranslationKey } from "@/lib/types"
8
7
import { DeveloperDocsLink } from "@/lib/interfaces"
9
8
10
- import { BaseLink , LinkProps } from "@/components/Link"
11
-
12
9
import docLinks from "@/data/developer-docs-links.yaml"
13
10
11
+ import { Center , HStack } from "./ui/flex"
12
+ import { BaseLink , LinkProps } from "./ui/Link"
14
13
import {
15
14
dropdownIconContainerVariant ,
16
15
type NavLinkProps as SideNavLinkProps ,
@@ -48,16 +47,7 @@ const innerLinksVariants = {
48
47
49
48
const LinkContainer = ( { children } : ChildOnlyProp ) => {
50
49
return (
51
- < HStack
52
- w = "full"
53
- justify = "space-between"
54
- py = { 2 }
55
- pe = { 8 }
56
- ps = { 2 }
57
- _hover = { {
58
- bgColor : "ednBackground" ,
59
- } }
60
- >
50
+ < HStack className = "w-full justify-between py-2 pe-8 ps-2 hover:bg-[ednBackground]" >
61
51
{ children }
62
52
</ HStack >
63
53
)
@@ -66,16 +56,7 @@ const LinkContainer = ({ children }: ChildOnlyProp) => {
66
56
const SideNavLink = ( { children, ...props } : LinkProps ) => {
67
57
return (
68
58
< BaseLink
69
- w = "full"
70
- textDecoration = "none"
71
- color = "text"
72
- _hover = { {
73
- textDecoration : "none" ,
74
- color : "primary.base" ,
75
- } }
76
- _active = { {
77
- color : "primary.base" ,
78
- } }
59
+ className = "w-full text-body no-underline hover:text-primary"
79
60
{ ...props }
80
61
>
81
62
{ children }
@@ -93,35 +74,32 @@ const NavLink = ({ item, path, toggle }: NavLinkProps) => {
93
74
94
75
if ( item . items ) {
95
76
return (
96
- < Box >
77
+ < div >
97
78
< LinkContainer >
98
79
{ item . href && (
99
80
< SideNavLink href = { item . href } isPartiallyActive = { false } >
100
81
{ t ( item . id ) }
101
82
</ SideNavLink >
102
83
) }
103
84
{ ! item . href && (
104
- < Box w = "full" cursor = "pointer" onClick = { ( ) => setIsOpen ( ! isOpen ) } >
85
+ < div
86
+ className = "w-full cursor-pointer"
87
+ onClick = { ( ) => setIsOpen ( ! isOpen ) }
88
+ >
105
89
{ t ( item . id ) }
106
- </ Box >
90
+ </ div >
107
91
) }
108
- < Box
109
- as = { motion . div }
110
- cursor = "pointer"
111
- display = "flex"
92
+ < motion . div
93
+ className = "flex cursor-pointer"
112
94
onClick = { ( ) => setIsOpen ( ! isOpen ) }
113
95
variants = { dropdownIconContainerVariant }
114
96
animate = { isOpen ? "open" : "closed" }
115
97
>
116
- < Icon as = { MdChevronRight } boxSize = { 6 } color = "secondary " />
117
- </ Box >
98
+ < MdChevronRight className = "h-6 w-6 text-body-medium " />
99
+ </ motion . div >
118
100
</ LinkContainer >
119
- < Box
120
- as = { motion . div }
121
- fontSize = "sm"
122
- lineHeight = "tall"
123
- fontWeight = "normal"
124
- ps = { 4 }
101
+ < motion . div
102
+ className = "ps-4 text-sm font-normal leading-relaxed"
125
103
key = { item . id }
126
104
animate = { isOpen ? "open" : "closed" }
127
105
variants = { innerLinksVariants }
@@ -130,18 +108,18 @@ const NavLink = ({ item, path, toggle }: NavLinkProps) => {
130
108
{ item . items . map ( ( childItem , idx ) => (
131
109
< NavLink item = { childItem } path = { path } key = { idx } toggle = { toggle } />
132
110
) ) }
133
- </ Box >
134
- </ Box >
111
+ </ motion . div >
112
+ </ div >
135
113
)
136
114
}
137
115
return (
138
- < Box onClick = { toggle } >
116
+ < div onClick = { toggle } >
139
117
< LinkContainer >
140
118
< SideNavLink href = { item . href } isPartiallyActive = { false } >
141
119
{ t ( item . id ) }
142
120
</ SideNavLink >
143
121
</ LinkContainer >
144
- </ Box >
122
+ </ div >
145
123
)
146
124
}
147
125
@@ -160,50 +138,26 @@ const SideNavMobile = ({ path }: SideNavMobileProps) => {
160
138
getPageTitleId ( path + "/" , docLinks ) || ( "Change page" as TranslationKey )
161
139
162
140
return (
163
- < Box
164
- position = "sticky"
165
- zIndex = { 2 }
166
- top = "75px"
167
- bgColor = "ednBackground"
168
- height = "auto"
169
- w = "full"
170
- hideFrom = "lg"
171
- >
172
- < Center
173
- as = { motion . div }
174
- fontWeight = "medium"
175
- color = "primary.base"
176
- cursor = "pointer"
177
- py = { 4 }
178
- px = { 8 }
179
- boxSizing = "border-box"
180
- bg = "ednBackground"
181
- borderBottom = "1px solid"
182
- borderBottomColor = "border"
183
- onClick = { ( ) => setIsOpen ( ! isOpen ) }
184
- >
185
- < Box me = { 2 } > { t ( pageTitleId ) } </ Box >
186
- < Box
187
- as = { motion . div }
188
- cursor = "pointer"
189
- display = "flex"
190
- variants = { dropdownIconContainerVariant }
191
- animate = { isOpen ? "open" : "closed" }
141
+ < div className = "sticky top-[75px] z-sticky h-auto w-full bg-background-highlight lg:hidden" >
142
+ < motion . div >
143
+ < Center
144
+ className = "box-border cursor-pointer border-b bg-background-highlight px-8 py-4 font-medium text-primary"
145
+ onClick = { ( ) => setIsOpen ( ! isOpen ) }
192
146
>
193
- < Icon as = { MdChevronRight } boxSize = { 6 } color = "secondary" />
194
- </ Box >
195
- </ Center >
147
+ < div > { t ( pageTitleId ) } </ div >
148
+ < motion . div
149
+ className = "flex cursor-pointer"
150
+ variants = { dropdownIconContainerVariant }
151
+ animate = { isOpen ? "open" : "closed" }
152
+ >
153
+ < MdChevronRight className = "h-6 w-6 text-body-medium" />
154
+ </ motion . div >
155
+ </ Center >
156
+ </ motion . div >
196
157
< AnimatePresence >
197
158
{ isOpen && (
198
- < Box
199
- as = { motion . nav }
200
- h = "auto"
201
- maxH = "calc(100vh - 139px)" // full height minus primary nav
202
- overflowY = "scroll"
203
- overflowX = "hidden"
204
- borderBottom = "1px solid"
205
- borderBottomColor = "border"
206
- p = { 2 }
159
+ < motion . nav
160
+ className = "max-h-[calc(100vh - 139px)] h-auto overflow-x-hidden overflow-y-scroll border-b p-2"
207
161
key = "nav"
208
162
initial = { { opacity : 0 } }
209
163
animate = { {
@@ -228,10 +182,10 @@ const SideNavMobile = ({ path }: SideNavMobileProps) => {
228
182
toggle = { ( ) => setIsOpen ( false ) }
229
183
/>
230
184
) ) }
231
- </ Box >
185
+ </ motion . nav >
232
186
) }
233
187
</ AnimatePresence >
234
- </ Box >
188
+ </ div >
235
189
)
236
190
}
237
191
0 commit comments