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
- import { trackCustomEvent } from "@/lib/utils/matomo"
21
10
22
11
import docLinks from "@/data/developer-docs-links.yaml"
23
12
13
+ import { Flex , Stack } from "./ui/flex"
14
+ import { BaseLink } from "./ui/Link"
15
+
24
16
import { useRtlFlip } from "@/hooks/useRtlFlip"
25
17
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 }
18
+ const TextDiv = ( { children, className, ...props } ) => (
19
+ < Stack
20
+ className = { cn (
21
+ "h-full max-w-[166px] justify-between gap-0 break-words p-4" ,
22
+ className
23
+ ) }
35
24
{ ...props }
36
25
>
37
26
{ children }
38
- </ Flex >
27
+ </ Stack >
39
28
)
40
29
41
30
type DocsArrayProps = {
@@ -53,51 +42,40 @@ const CardLink = ({ docData, isPrev, contentNotTranslated }: CardLinkProps) => {
53
42
const { t } = useTranslation ( "page-developers-docs" )
54
43
const { isRtl } = useRtlFlip ( )
55
44
56
- const xPadding = isPrev ? { ps : " 0" } : { pe : 0 }
45
+ const xPaddingClass = isPrev ? "ps- 0" : "pe-0"
57
46
58
47
return (
59
- < 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
+ < BaseLink
49
+ href = { docData . href }
50
+ className = { cn (
51
+ "flex w-full flex-1 items-center no-underline" ,
52
+ "h-[82px] rounded-[1px] border bg-background" ,
53
+ isPrev ? "justify-start" : "justify-end"
54
+ ) }
55
+ rel = { isPrev ? "prev" : "next" }
56
+ customEventOptions = { {
57
+ eventCategory : "next/previous article DocsNav" ,
58
+ eventAction : "click" ,
59
+ eventName : isPrev ? "previous" : "next" ,
60
+ } }
70
61
>
71
- < Box textDecoration = "none" p = { 4 } h = "100%" order = { isPrev ? 0 : 1 } >
62
+ < div className = { cn ( "h-full p-4" , isPrev ? "order-[0]" : "order-1" ) } >
72
63
< Emoji
73
64
text = { isPrev ? ":point_left:" : ":point_right:" }
74
65
className = { cn (
75
66
"text-5xl" ,
76
67
! contentNotTranslated && isRtl ? "-scale-x-100" : ""
77
68
) }
78
69
/>
79
- </ Box >
80
- < TextDiv { ...xPadding } { ...( ! isPrev && { textAlign : "end" } ) } >
81
- < Text textTransform = "uppercase" m = "0" >
82
- { t ( isPrev ? "previous" : "next" ) }
83
- </ Text >
84
- < LinkOverlay
85
- as = { BaseLink }
86
- href = { docData . href }
87
- textAlign = { isPrev ? "start" : "end" }
88
- rel = { isPrev ? "prev" : "next" }
89
- onClick = { ( ) => {
90
- trackCustomEvent ( {
91
- eventCategory : "next/previous article DocsNav" ,
92
- eventAction : "click" ,
93
- eventName : isPrev ? "previous" : "next" ,
94
- } )
95
- } }
96
- >
70
+ </ div >
71
+ < TextDiv className = { cn ( xPaddingClass , ! isPrev ? "text-end" : "" ) } >
72
+ < p className = "uppercase text-body" > { t ( isPrev ? "previous" : "next" ) } </ p >
73
+
74
+ < p className = { cn ( "underline" , isPrev ? "text-start" : "text-end" ) } >
97
75
{ t ( docData . id ) }
98
- </ LinkOverlay >
76
+ </ p >
99
77
</ TextDiv >
100
- </ LinkBox >
78
+ </ BaseLink >
101
79
)
102
80
}
103
81
@@ -146,18 +124,12 @@ const DocsNav = ({ contentNotTranslated }: DocsNavProps) => {
146
124
147
125
return (
148
126
< Flex
149
- as = "nav"
127
+ className = { cn (
128
+ "flex-col-reverse md:flex-row lg:flex-col-reverse xl:flex-row" ,
129
+ "mt-8 justify-between gap-4" ,
130
+ "items-center md:items-start"
131
+ ) }
150
132
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
133
>
162
134
{ previousDoc ? (
163
135
< CardLink
@@ -166,15 +138,15 @@ const DocsNav = ({ contentNotTranslated }: DocsNavProps) => {
166
138
isPrev
167
139
/>
168
140
) : (
169
- < Spacer / >
141
+ < div className = "hidden flex-grow xl:block" > </ div >
170
142
) }
171
143
{ nextDoc ? (
172
144
< CardLink
173
145
docData = { nextDoc }
174
146
contentNotTranslated = { contentNotTranslated }
175
147
/>
176
148
) : (
177
- < Spacer / >
149
+ < div className = "hidden flex-grow xl:block" > </ div >
178
150
) }
179
151
</ Flex >
180
152
)
0 commit comments