diff --git a/src/Pagination.tsx b/src/Pagination.tsx
index 43a3759b7..01b830812 100644
--- a/src/Pagination.tsx
+++ b/src/Pagination.tsx
@@ -1,4 +1,4 @@
-import React, { memo, forwardRef, type CSSProperties } from "react";
+import React, { memo, forwardRef, type CSSProperties, ReactNode } from "react";
import { symToStr } from "tsafe/symToStr";
import { assert } from "tsafe/assert";
import type { Equals } from "tsafe";
@@ -8,6 +8,18 @@ import { createComponentI18nApi } from "./i18n";
import { RegisteredLinkProps, getLink } from "./link";
import { useAnalyticsId } from "./tools/useAnalyticsId";
+const DynamicLink = ({
+ useReactLinkComponent,
+ children,
+ ...rest
+}: {
+ useReactLinkComponent: boolean;
+ children: ReactNode;
+}) => {
+ const { Link } = getLink();
+ return useReactLinkComponent ? {children} : {children};
+};
+
export type PaginationProps = {
id?: string;
className?: string;
@@ -100,36 +112,43 @@ export const Pagination = memo(
{showFirstLast && (
-
- 1}
{...(count > 0 && defaultPage > 1 && getPageLinkProps(1))}
- className={cx(
- fr.cx("fr-pagination__link", "fr-pagination__link--first"),
- classes.link,
- getPageLinkProps(1).className
- )}
- aria-disabled={count > 0 && defaultPage > 1 ? true : undefined}
- role="link"
+ {...{
+ className: cx(
+ fr.cx("fr-pagination__link", "fr-pagination__link--first"),
+ classes.link,
+ getPageLinkProps(1).className
+ ),
+ "aria-disabled":
+ count > 0 && defaultPage > 1 ? true : undefined,
+ role: "link"
+ }}
>
{t("first page")}
-
+
)}
-
- 1}
{...(defaultPage > 1 && getPageLinkProps(defaultPage - 1))}
- aria-disabled={defaultPage <= 1 ? true : undefined}
- role="link"
+ {...{
+ className: cx(
+ fr.cx(
+ "fr-pagination__link",
+ "fr-pagination__link--prev",
+ "fr-pagination__link--lg-label"
+ ),
+ classes.link
+ ),
+ "aria-disabled": defaultPage <= 1 ? true : undefined,
+ role: "link"
+ }}
>
{t("previous page")}
-
+
{parts.map(part => (
-
@@ -150,34 +169,40 @@ export const Pagination = memo(
))}
-
-
{t("next page")}
-
+
{showFirstLast && (
-
-
{t("last page")}
-
+
)}