1
+ import { FaChevronLeft , FaChevronRight } from "react-icons/fa"
2
+
1
3
import { TranslationKey } from "@/lib/types"
2
4
import type { DeveloperDocsLink } from "@/lib/interfaces"
3
5
4
- import Emoji from "@/components/Emoji "
6
+ import { BaseLink } from "@/components/ui/Link "
5
7
6
8
import { cn } from "@/lib/utils/cn"
7
9
import { trackCustomEvent } from "@/lib/utils/matomo"
8
10
9
11
import docLinks from "@/data/developer-docs-links.yaml"
10
12
11
- import { Stack } from "./ui/flex"
12
- import { LinkBox , LinkOverlay } from "./ui/link-box"
13
-
14
13
import { useRtlFlip } from "@/hooks/useRtlFlip"
15
14
import { useTranslation } from "@/hooks/useTranslation"
16
15
import { usePathname } from "@/i18n/routing"
17
16
18
17
const TextDiv = ( { children, className, ...props } ) => (
19
- < Stack
18
+ < div
20
19
className = { cn (
21
- "h-full max-w-[166px] justify-between gap-0 break-words p-4" ,
20
+ "flex h-full w-full flex-col justify-center break-words p-4" ,
22
21
className
23
22
) }
24
23
{ ...props }
25
24
>
26
25
{ children }
27
- </ Stack >
26
+ </ div >
28
27
)
29
28
30
29
type DocsArrayProps = {
@@ -40,43 +39,45 @@ type CardLinkProps = {
40
39
41
40
const CardLink = ( { docData, isPrev, contentNotTranslated } : CardLinkProps ) => {
42
41
const { t } = useTranslation ( "page-developers-docs" )
43
- const { isRtl } = useRtlFlip ( )
42
+ const { twFlipForRtl } = useRtlFlip ( )
44
43
45
44
return (
46
- < LinkBox
45
+ < BaseLink
46
+ href = { docData . href }
47
47
className = { cn (
48
- "flex w-full flex-1 items-center no-underline" ,
49
- "h-[82px] rounded-sm border bg-background ",
50
- isPrev ? "justify-start" : "justify-end "
48
+ "group flex w-full items-center rounded-sm border border-primary bg-background ! no-underline" ,
49
+ isPrev ? "justify-start" : "justify-end ",
50
+ "hover:border-primary-hover "
51
51
) }
52
+ rel = { isPrev ? "prev" : "next" }
53
+ onClick = { ( ) => {
54
+ trackCustomEvent ( {
55
+ eventCategory : "next/previous article DocsNav" ,
56
+ eventAction : "click" ,
57
+ eventName : isPrev ? "previous" : "next" ,
58
+ } )
59
+ } }
52
60
>
53
- < div className = { cn ( "h-full p-4" , isPrev ? "order-[0]" : "order-1" ) } >
54
- < Emoji
55
- text = { isPrev ? ":point_left:" : ":point_right:" }
56
- className = { cn (
57
- "text-5xl" ,
58
- ! contentNotTranslated && isRtl ? "-scale-x-100" : ""
59
- ) }
60
- />
61
+ < div
62
+ className = { cn (
63
+ "p-4" ,
64
+ isPrev ? "order-0" : "order-1" ,
65
+ ! contentNotTranslated && twFlipForRtl
66
+ ) }
67
+ >
68
+ { isPrev ? (
69
+ < FaChevronLeft className = "text-xl group-hover:fill-primary-hover" />
70
+ ) : (
71
+ < FaChevronRight className = "text-xl group-hover:fill-primary-hover" />
72
+ ) }
61
73
</ div >
62
- < TextDiv className = { cn ( ! isPrev ? "pe-0 text-end" : "ps-0" ) } >
63
- < p className = "uppercase text-body" > { t ( isPrev ? "previous" : "next" ) } </ p >
64
- < LinkOverlay
65
- href = { docData . href }
66
- onClick = { ( ) => {
67
- trackCustomEvent ( {
68
- eventCategory : "next/previous article DocsNav" ,
69
- eventAction : "click" ,
70
- eventName : isPrev ? "previous" : "next" ,
71
- } )
72
- } }
73
- className = { cn ( "underline" , isPrev ? "text-start" : "text-end" ) }
74
- rel = { isPrev ? "prev" : "next" }
75
- >
76
- { t ( docData . id ) }
77
- </ LinkOverlay >
74
+ < TextDiv className = { cn ( isPrev ? "ps-0" : "pe-0 text-end" ) } >
75
+ < p className = "btn-txt !m-0 text-lg text-primary group-hover:text-primary-hover" >
76
+ { t ( isPrev ? "previous" : "next" ) }
77
+ </ p >
78
+ < p className = "!mb-0 text-sm no-underline" > { t ( docData . id ) } </ p >
78
79
</ TextDiv >
79
- </ LinkBox >
80
+ </ BaseLink >
80
81
)
81
82
}
82
83
@@ -89,11 +90,11 @@ const DocsNav = ({ contentNotTranslated }: DocsNavProps) => {
89
90
// Construct array of all linkable documents in order recursively
90
91
const docsArray : DocsArrayProps [ ] = [ ]
91
92
const getDocs = ( links : Array < DeveloperDocsLink > ) : void => {
93
+ // If object has 'items' key
92
94
for ( const item of links ) {
93
- // If object has 'items' key
95
+ // And if item has a 'to' key
96
+ // Add 'to' path and 'id' to docsArray
94
97
if ( item . items ) {
95
- // And if item has a 'to' key
96
- // Add 'to' path and 'id' to docsArray
97
98
item . href && docsArray . push ( { href : item . href , id : item . id } )
98
99
// Then recursively add sub-items
99
100
getDocs ( item . items )
@@ -128,7 +129,7 @@ const DocsNav = ({ contentNotTranslated }: DocsNavProps) => {
128
129
className = { cn (
129
130
"flex flex-col-reverse md:flex-row lg:flex-col-reverse xl:flex-row" ,
130
131
"mt-8 justify-between gap-4" ,
131
- "items-center md:items-start "
132
+ "items-stretch "
132
133
) }
133
134
aria-label = "Paginate to document"
134
135
>
@@ -139,15 +140,15 @@ const DocsNav = ({ contentNotTranslated }: DocsNavProps) => {
139
140
isPrev
140
141
/>
141
142
) : (
142
- < div className = "hidden flex-grow xl:block" > </ div >
143
+ < div className = "hidden flex-grow xl:block" / >
143
144
) }
144
145
{ nextDoc ? (
145
146
< CardLink
146
147
docData = { nextDoc }
147
148
contentNotTranslated = { contentNotTranslated }
148
149
/>
149
150
) : (
150
- < div className = "hidden flex-grow xl:block" > </ div >
151
+ < div className = "hidden flex-grow xl:block" / >
151
152
) }
152
153
</ nav >
153
154
)
0 commit comments