From 1a7385f6f3d73f8823729f04bb783b16729bcad6 Mon Sep 17 00:00:00 2001 From: rajun Date: Tue, 27 Oct 2026 16:28:55 +0530 Subject: [PATCH] feat: add pagination link --- .../assets/list/pagination-link.tsx | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 app/components/assets/list/pagination-link.tsx diff --git a/app/components/assets/list/pagination-link.tsx b/app/components/assets/list/pagination-link.tsx new file mode 100644 index 0000000..c9249da --- /dev/null +++ b/app/components/assets/list/pagination-link.tsx @@ -0,0 +1,33 @@ +import type { ReactNode } from 'react'; +import { Link, useLocation } from 'react-router'; +import { Button } from '~/components/ui/button'; +import { cn } from '~/lib/utils'; + +interface PaginationLinkProps { + page: number; + active?: boolean; + disabled?: boolean; + label?: string; + children: ReactNode; +} + +// Links to another page of the current list, keeping its other search params (e.g. the filter) +export function PaginationLink({ page, active, disabled, label, children }: PaginationLinkProps) { + const { search } = useLocation(); + const params = new URLSearchParams(search); + params.set('page', String(page)); + + return ( + + ); +}