diff --git a/examples/algolia/src/components/pagination/Pagination.tsx b/examples/algolia/src/components/pagination/Pagination.tsx index b994961a..3e6fbc8a 100644 --- a/examples/algolia/src/components/pagination/Pagination.tsx +++ b/examples/algolia/src/components/pagination/Pagination.tsx @@ -53,7 +53,7 @@ const PaginationLink = ({ aria-current={isActive ? "page" : undefined} className={cn( buttonVariants({ - variant: "link", + variant: isActive ? "primary" : "secondary", size, }), className, @@ -64,6 +64,30 @@ const PaginationLink = ({ ); PaginationLink.displayName = "PaginationLink"; +type PaginationButtonProps = { + isActive?: boolean; +} & ButtonProps; + +const PaginationButton = ({ + className, + isActive, + size = "small", + ...props +}: PaginationButtonProps) => ( + + + + {pages.map((pageNumber) => ( + + refine(pageNumber)} + disabled={!canRefine} + > + {pageNumber + 1} + + ))} - - + + ); }; diff --git a/examples/algolia/src/components/search/SearchResults.tsx b/examples/algolia/src/components/search/SearchResults.tsx index 656a853b..d43e0482 100644 --- a/examples/algolia/src/components/search/SearchResults.tsx +++ b/examples/algolia/src/components/search/SearchResults.tsx @@ -98,7 +98,7 @@ export default function SearchResults({ lookup }: ISearchResults): JSX.Element {
-
+

Category

{nav && } diff --git a/examples/payments/src/components/pagination/Pagination.tsx b/examples/payments/src/components/pagination/Pagination.tsx index b994961a..3e6fbc8a 100644 --- a/examples/payments/src/components/pagination/Pagination.tsx +++ b/examples/payments/src/components/pagination/Pagination.tsx @@ -53,7 +53,7 @@ const PaginationLink = ({ aria-current={isActive ? "page" : undefined} className={cn( buttonVariants({ - variant: "link", + variant: isActive ? "primary" : "secondary", size, }), className, @@ -64,6 +64,30 @@ const PaginationLink = ({ ); PaginationLink.displayName = "PaginationLink"; +type PaginationButtonProps = { + isActive?: boolean; +} & ButtonProps; + +const PaginationButton = ({ + className, + isActive, + size = "small", + ...props +}: PaginationButtonProps) => ( +

-
+

Category

{nav && } diff --git a/examples/simple/src/components/pagination/Pagination.tsx b/examples/simple/src/components/pagination/Pagination.tsx index b994961a..3e6fbc8a 100644 --- a/examples/simple/src/components/pagination/Pagination.tsx +++ b/examples/simple/src/components/pagination/Pagination.tsx @@ -53,7 +53,7 @@ const PaginationLink = ({ aria-current={isActive ? "page" : undefined} className={cn( buttonVariants({ - variant: "link", + variant: isActive ? "primary" : "secondary", size, }), className, @@ -64,6 +64,30 @@ const PaginationLink = ({ ); PaginationLink.displayName = "PaginationLink"; +type PaginationButtonProps = { + isActive?: boolean; +} & ButtonProps; + +const PaginationButton = ({ + className, + isActive, + size = "small", + ...props +}: PaginationButtonProps) => ( +

-
+

Category

{nav && } diff --git a/packages/d2c-schematics/product-list-page-simple/files/src/components/search/Pagination.tsx.template b/packages/d2c-schematics/product-list-page-simple/files/src/components/search/Pagination.tsx.template index fd4ef417..35c91e96 100644 --- a/packages/d2c-schematics/product-list-page-simple/files/src/components/search/Pagination.tsx.template +++ b/packages/d2c-schematics/product-list-page-simple/files/src/components/search/Pagination.tsx.template @@ -1,8 +1,12 @@ import React from "react"; import { useProducts } from "./ProductsProvider"; -import clsx from "clsx"; -import Link from "next/link"; import { usePathname } from "next/navigation"; +import { + Pagination as DisplayPagination, + PaginationContent, + PaginationItem, PaginationLink, +} from "../pagination/Pagination"; + function calculateTotalPages(totalItems: number, limit: number): number { // Ensure both totalItems and limit are positive integers @@ -30,30 +34,23 @@ export const Pagination = (): JSX.Element => { const totalPages = calculateTotalPages(totalResults, page.meta.page.limit); return ( -
-
- {[...Array(totalPages).keys()].map((currentPage) => ( - - {currentPage + 1} - - ))} -
-
- ); + + + {[...Array(totalPages).keys()].map((pageNumber) => ( + + + {pageNumber + 1} + + + ))} + + + ) }; export default Pagination; diff --git a/packages/d2c-schematics/product-list-page-simple/files/src/components/search/SearchResults.tsx.template b/packages/d2c-schematics/product-list-page-simple/files/src/components/search/SearchResults.tsx.template index 357aba76..2adc7409 100644 --- a/packages/d2c-schematics/product-list-page-simple/files/src/components/search/SearchResults.tsx.template +++ b/packages/d2c-schematics/product-list-page-simple/files/src/components/search/SearchResults.tsx.template @@ -49,7 +49,7 @@ export default function SearchResults({

-
+

Category

{nav && }