From 113d80c3ff325bc91a5456de11648dd6f919b1fa Mon Sep 17 00:00:00 2001 From: Ravi Rajput Date: Tue, 27 Feb 2024 23:12:31 +0530 Subject: [PATCH] Replaced pagination with shadcn's pagination --- apps/web/app/app/[keyid]/files/page.tsx | 115 ++++++++++++++++------- apps/web/components/ui/pagination.tsx | 117 ++++++++++++++++++++++++ 2 files changed, 197 insertions(+), 35 deletions(-) create mode 100644 apps/web/components/ui/pagination.tsx diff --git a/apps/web/app/app/[keyid]/files/page.tsx b/apps/web/app/app/[keyid]/files/page.tsx index 3917c49e..dee71564 100644 --- a/apps/web/app/app/[keyid]/files/page.tsx +++ b/apps/web/app/app/[keyid]/files/page.tsx @@ -1,10 +1,21 @@ -import Link from "next/link"; import { redirect } from "next/navigation"; import { auth } from "@/auth"; import { getMediaFiles, getCount } from "./actions"; import { Media } from "@medialit/models"; -import { Button } from "@/components/ui/button"; import FilePreview from "./file-preview"; +import { + Pagination, + PaginationContent, + PaginationEllipsis, + PaginationItem, + PaginationLink, + PaginationNext, + PaginationPrevious, +} from "@/components/ui/pagination"; +import { + DoubleArrowLeftIcon, + DoubleArrowRightIcon, +} from "@radix-ui/react-icons"; export default async function Media({ params, @@ -49,42 +60,76 @@ export default async function Media({ ))} - -
- - - -

- {page} of {totalPages} ( - {medias.length} Files) -

- - - -
+ `} + > + + + + + ); } diff --git a/apps/web/components/ui/pagination.tsx b/apps/web/components/ui/pagination.tsx new file mode 100644 index 00000000..27034588 --- /dev/null +++ b/apps/web/components/ui/pagination.tsx @@ -0,0 +1,117 @@ +import * as React from "react"; +import { ChevronLeft, ChevronRight, MoreHorizontal } from "lucide-react"; + +import { cn } from "@/lib/utils"; +import { ButtonProps, buttonVariants } from "@/components/ui/button"; + +const Pagination = ({ className, ...props }: React.ComponentProps<"nav">) => ( +