1
1
import { useRouter } from "next/router"
2
2
import { useTranslation } from "next-i18next"
3
- import {
4
- Box ,
5
- Flex ,
6
- FlexProps ,
7
- LinkBox ,
8
- LinkOverlay ,
9
- Spacer ,
10
- } from "@chakra-ui/react"
11
3
12
4
import { TranslationKey } from "@/lib/types"
13
5
import type { DeveloperDocsLink } from "@/lib/interfaces"
14
6
15
7
import Emoji from "@/components/Emoji"
16
- import { BaseLink } from "@/components/Link"
17
- import Text from "@/components/OldText"
18
8
19
9
import { cn } from "@/lib/utils/cn"
20
10
import { trackCustomEvent } from "@/lib/utils/matomo"
21
11
22
12
import docLinks from "@/data/developer-docs-links.yaml"
23
13
14
+ import { Stack } from "./ui/flex"
15
+ import { LinkBox , LinkOverlay } from "./ui/link-box"
16
+
24
17
import { useRtlFlip } from "@/hooks/useRtlFlip"
25
18
26
- const TextDiv = ( { children, ...props } : FlexProps ) => (
27
- < Flex
28
- direction = "column"
29
- justify = "space-between"
30
- maxW = "166px"
31
- h = "100%"
32
- wordwrap = "break-word"
33
- p = { 4 }
34
- lineHeight = { 4 }
19
+ const TextDiv = ( { children, className, ...props } ) => (
20
+ < Stack
21
+ className = { cn (
22
+ "h-full max-w-[166px] justify-between gap-0 break-words p-4" ,
23
+ className
24
+ ) }
35
25
{ ...props }
36
26
>
37
27
{ children }
38
- </ Flex >
28
+ </ Stack >
39
29
)
40
30
41
31
type DocsArrayProps = {
@@ -53,46 +43,36 @@ const CardLink = ({ docData, isPrev, contentNotTranslated }: CardLinkProps) => {
53
43
const { t } = useTranslation ( "page-developers-docs" )
54
44
const { isRtl } = useRtlFlip ( )
55
45
56
- const xPadding = isPrev ? { ps : "0" } : { pe : 0 }
57
-
58
46
return (
59
47
< LinkBox
60
- as = { Flex }
61
- alignItems = "center"
62
- w = "full"
63
- flex = "1"
64
- h = "82px"
65
- bg = "background.base"
66
- border = "1px"
67
- borderColor = "border"
68
- borderRadius = { 1 }
69
- justify = { isPrev ? "flex-start" : "flex-end" }
48
+ className = { cn (
49
+ "flex w-full flex-1 items-center no-underline" ,
50
+ "h-[82px] rounded-sm border bg-background" ,
51
+ isPrev ? "justify-start" : "justify-end"
52
+ ) }
70
53
>
71
- < Box textDecoration = "none" p = { 4 } h = "100%" order = { isPrev ? 0 : 1 } >
54
+ < div className = { cn ( "h-full p-4" , isPrev ? "order-[0]" : "order-1" ) } >
72
55
< Emoji
73
56
text = { isPrev ? ":point_left:" : ":point_right:" }
74
57
className = { cn (
75
58
"text-5xl" ,
76
59
! contentNotTranslated && isRtl ? "-scale-x-100" : ""
77
60
) }
78
61
/>
79
- </ Box >
80
- < TextDiv { ...xPadding } { ...( ! isPrev && { textAlign : "end" } ) } >
81
- < Text textTransform = "uppercase" m = "0" >
82
- { t ( isPrev ? "previous" : "next" ) }
83
- </ Text >
62
+ </ div >
63
+ < TextDiv className = { cn ( ! isPrev ? "pe-0 text-end" : "ps-0" ) } >
64
+ < p className = "uppercase text-body" > { t ( isPrev ? "previous" : "next" ) } </ p >
84
65
< LinkOverlay
85
- as = { BaseLink }
86
66
href = { docData . href }
87
- textAlign = { isPrev ? "start" : "end" }
88
- rel = { isPrev ? "prev" : "next" }
89
67
onClick = { ( ) => {
90
68
trackCustomEvent ( {
91
69
eventCategory : "next/previous article DocsNav" ,
92
70
eventAction : "click" ,
93
71
eventName : isPrev ? "previous" : "next" ,
94
72
} )
95
73
} }
74
+ className = { cn ( "underline" , isPrev ? "text-start" : "text-end" ) }
75
+ rel = { isPrev ? "prev" : "next" }
96
76
>
97
77
{ t ( docData . id ) }
98
78
</ LinkOverlay >
@@ -145,19 +125,13 @@ const DocsNav = ({ contentNotTranslated }: DocsNavProps) => {
145
125
currentIndex + 1 < docsArray . length ? docsArray [ currentIndex + 1 ] : null
146
126
147
127
return (
148
- < Flex
149
- as = "nav"
128
+ < nav
129
+ className = { cn (
130
+ "flex flex-col-reverse md:flex-row lg:flex-col-reverse xl:flex-row" ,
131
+ "mt-8 justify-between gap-4" ,
132
+ "items-center md:items-start"
133
+ ) }
150
134
aria-label = "Paginate to document"
151
- direction = { {
152
- base : "column-reverse" ,
153
- md : "row" ,
154
- lg : "column-reverse" ,
155
- xl : "row" ,
156
- } }
157
- mt = "8"
158
- gap = "4"
159
- justify = "space-between"
160
- alignItems = { { base : "center" , md : "flex-start" } }
161
135
>
162
136
{ previousDoc ? (
163
137
< CardLink
@@ -166,17 +140,17 @@ const DocsNav = ({ contentNotTranslated }: DocsNavProps) => {
166
140
isPrev
167
141
/>
168
142
) : (
169
- < Spacer / >
143
+ < div className = "hidden flex-grow xl:block" > </ div >
170
144
) }
171
145
{ nextDoc ? (
172
146
< CardLink
173
147
docData = { nextDoc }
174
148
contentNotTranslated = { contentNotTranslated }
175
149
/>
176
150
) : (
177
- < Spacer / >
151
+ < div className = "hidden flex-grow xl:block" > </ div >
178
152
) }
179
- </ Flex >
153
+ </ nav >
180
154
)
181
155
}
182
156
0 commit comments