@@ -2,15 +2,15 @@ import { useEffect, useState } from "react"
2
2
import { motion } from "framer-motion"
3
3
import { useTranslation } from "next-i18next"
4
4
import { MdChevronRight } from "react-icons/md"
5
- import { Box , HStack , Icon } from "@chakra-ui/react"
6
5
7
6
import { ChildOnlyProp } 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 { HStack } from "./ui/flex"
12
+ import { BaseLink , LinkProps } from "./ui/Link"
13
+
14
14
export const dropdownIconContainerVariant = {
15
15
open : {
16
16
rotate : 90 ,
@@ -34,14 +34,7 @@ const innerLinksVariants = {
34
34
35
35
const LinkContainer = ( { children } : ChildOnlyProp ) => {
36
36
return (
37
- < HStack
38
- w = "full"
39
- justify = "space-between"
40
- py = { 2 }
41
- pe = { 4 }
42
- ps = { 8 }
43
- _hover = { { bgColor : "ednBackground" } }
44
- >
37
+ < HStack className = "w-full justify-between py-2 pe-4 ps-8 hover:bg-background-highlight" >
45
38
{ children }
46
39
</ HStack >
47
40
)
@@ -50,12 +43,7 @@ const LinkContainer = ({ children }: ChildOnlyProp) => {
50
43
const SideNavLink = ( { children, ...props } : LinkProps ) => {
51
44
return (
52
45
< BaseLink
53
- w = "full"
54
- textDecoration = "none"
55
- color = "text"
56
- fontWeight = "normal"
57
- _hover = { { textDecoration : "none" , color : "primary.base" } }
58
- _active = { { color : "primary.base" } }
46
+ className = "w-full font-normal text-body no-underline hover:text-primary"
59
47
{ ...props }
60
48
>
61
49
{ children }
@@ -86,35 +74,32 @@ const NavLink = ({ item, path, isTopLevel }: NavLinkProps) => {
86
74
87
75
if ( item . items ) {
88
76
return (
89
- < Box >
77
+ < div >
90
78
< LinkContainer >
91
79
{ item . href && (
92
80
< SideNavLink href = { item . href } isPartiallyActive = { false } >
93
81
{ t ( item . id ) }
94
82
</ SideNavLink >
95
83
) }
96
84
{ ! item . href && (
97
- < Box w = "full" cursor = "pointer" onClick = { ( ) => setIsOpen ( ! isOpen ) } >
85
+ < div
86
+ className = "w-full cursor-pointer"
87
+ onClick = { ( ) => setIsOpen ( ! isOpen ) }
88
+ >
98
89
{ t ( item . id ) }
99
- </ Box >
90
+ </ div >
100
91
) }
101
- < Box
102
- as = { motion . div }
92
+ < motion . div
93
+ className = "flex cursor-pointer"
103
94
onClick = { ( ) => setIsOpen ( ! isOpen ) }
104
95
variants = { dropdownIconContainerVariant }
105
96
animate = { isOpen ? "open" : "closed" }
106
- cursor = "pointer"
107
- display = "flex"
108
97
>
109
- < Icon as = { MdChevronRight } boxSize = { 6 } color = "secondary " />
110
- </ Box >
98
+ < MdChevronRight className = "h-6 w-6 text-body-medium " />
99
+ </ motion . div >
111
100
</ LinkContainer >
112
- < Box
113
- as = { motion . div }
114
- fontSize = "sm"
115
- lineHeight = "tall"
116
- fontWeight = "normal"
117
- ms = { 4 }
101
+ < motion . div
102
+ className = "ms-4 text-sm font-normal leading-relaxed"
118
103
key = { item . id }
119
104
animate = { isOpen ? "open" : "closed" }
120
105
variants = { innerLinksVariants }
@@ -123,18 +108,18 @@ const NavLink = ({ item, path, isTopLevel }: NavLinkProps) => {
123
108
{ item . items . map ( ( childItem , idx ) => (
124
109
< NavLink item = { childItem } path = { path } key = { idx } />
125
110
) ) }
126
- </ Box >
127
- </ Box >
111
+ </ motion . div >
112
+ </ div >
128
113
)
129
114
}
130
115
return (
131
- < Box >
116
+ < div >
132
117
< LinkContainer >
133
118
< SideNavLink href = { item . href } isPartiallyActive = { false } >
134
119
{ t ( item . id ) }
135
120
</ SideNavLink >
136
121
</ LinkContainer >
137
- </ Box >
122
+ </ div >
138
123
)
139
124
}
140
125
@@ -149,28 +134,14 @@ const SideNav = ({ path }: SideNavProps) => {
149
134
const { t } = useTranslation ( "page-developers-docs" )
150
135
151
136
return (
152
- < Box
153
- as = "nav"
154
- position = "sticky"
155
- top = "19"
156
- pt = { 8 }
157
- pb = { 16 }
158
- h = "calc(100vh - 80px)" // TODO take footer into account for height?
159
- w = "calc((100% - 1448px) / 2 + 256px)"
160
- minW = "256px"
161
- overflowY = "auto"
162
- transition = "transform 0.2s ease"
163
- bgColor = "background.base"
164
- boxShadow = "1px 0px 0px rgba(0, 0, 0, 0.1)"
165
- borderInlineEnd = "1px solid"
166
- borderInlineEndColor = "border"
167
- display = { { base : "none" , lg : "block" } }
137
+ < nav
138
+ className = "sticky top-[4.75rem] hidden h-[calc(100vh-80px)] w-[calc((100%-1448px)/2+256px)] min-w-[256px] overflow-y-auto border-e bg-background pb-16 pt-8 shadow-[1px_0px_0px_rgba(0,0,0,0.1)] transition-transform duration-200 lg:block"
168
139
aria-label = { t ( "common:nav-developers-docs" ) }
169
140
>
170
141
{ docLinks . map ( ( item , idx ) => (
171
142
< NavLink item = { item } path = { path } key = { idx } isTopLevel />
172
143
) ) }
173
- </ Box >
144
+ </ nav >
174
145
)
175
146
}
176
147
0 commit comments