diff --git a/src/components/DocsNav.tsx b/src/components/DocsNav.tsx index dce514dc45c..b580805ecab 100644 --- a/src/components/DocsNav.tsx +++ b/src/components/DocsNav.tsx @@ -1,30 +1,29 @@ +import { FaChevronLeft, FaChevronRight } from "react-icons/fa" + import { TranslationKey } from "@/lib/types" import type { DeveloperDocsLink } from "@/lib/interfaces" -import Emoji from "@/components/Emoji" +import { BaseLink } from "@/components/ui/Link" import { cn } from "@/lib/utils/cn" import { trackCustomEvent } from "@/lib/utils/matomo" import docLinks from "@/data/developer-docs-links.yaml" -import { Stack } from "./ui/flex" -import { LinkBox, LinkOverlay } from "./ui/link-box" - import { useRtlFlip } from "@/hooks/useRtlFlip" import { useTranslation } from "@/hooks/useTranslation" import { usePathname } from "@/i18n/routing" const TextDiv = ({ children, className, ...props }) => ( - {children} - + ) type DocsArrayProps = { @@ -40,43 +39,45 @@ type CardLinkProps = { const CardLink = ({ docData, isPrev, contentNotTranslated }: CardLinkProps) => { const { t } = useTranslation("page-developers-docs") - const { isRtl } = useRtlFlip() + const { twFlipForRtl } = useRtlFlip() return ( - { + trackCustomEvent({ + eventCategory: "next/previous article DocsNav", + eventAction: "click", + eventName: isPrev ? "previous" : "next", + }) + }} > -
- +
+ {isPrev ? ( + + ) : ( + + )}
- -

{t(isPrev ? "previous" : "next")}

- { - trackCustomEvent({ - eventCategory: "next/previous article DocsNav", - eventAction: "click", - eventName: isPrev ? "previous" : "next", - }) - }} - className={cn("underline", isPrev ? "text-start" : "text-end")} - rel={isPrev ? "prev" : "next"} - > - {t(docData.id)} - + +

+ {t(isPrev ? "previous" : "next")} +

+

{t(docData.id)}

- + ) } @@ -89,11 +90,11 @@ const DocsNav = ({ contentNotTranslated }: DocsNavProps) => { // Construct array of all linkable documents in order recursively const docsArray: DocsArrayProps[] = [] const getDocs = (links: Array): void => { + // If object has 'items' key for (const item of links) { - // If object has 'items' key + // And if item has a 'to' key + // Add 'to' path and 'id' to docsArray if (item.items) { - // And if item has a 'to' key - // Add 'to' path and 'id' to docsArray item.href && docsArray.push({ href: item.href, id: item.id }) // Then recursively add sub-items getDocs(item.items) @@ -128,7 +129,7 @@ const DocsNav = ({ contentNotTranslated }: DocsNavProps) => { className={cn( "flex flex-col-reverse md:flex-row lg:flex-col-reverse xl:flex-row", "mt-8 justify-between gap-4", - "items-center md:items-start" + "items-stretch" )} aria-label="Paginate to document" > @@ -139,7 +140,7 @@ const DocsNav = ({ contentNotTranslated }: DocsNavProps) => { isPrev /> ) : ( -
+
)} {nextDoc ? ( { contentNotTranslated={contentNotTranslated} /> ) : ( -
+
)} )