Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: removed pagination from tracks #652

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 1 addition & 44 deletions apps/web/components/Tracks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ import {
Button,
Skeleton,
Separator,
Pagination,
PaginationContent,
PaginationEllipsis,
PaginationItem,
PaginationLink,
PaginationNext,
PaginationPrevious,
} from "@repo/ui";
import { motion } from "framer-motion";

Expand Down Expand Up @@ -128,7 +121,7 @@ export const Tracks = ({ tracks, categories }: TracksWithCategoriesProps) => {
initial={{ y: -20, opacity: 0 }}
animate={{ y: 0, opacity: 1 }}
transition={{ duration: 0.5, ease: "easeInOut", type: "spring", damping: 10, delay: 0.5 }}
className="flex max-w-5xl flex-col gap-4 w-full mx-auto p-4"
className="flex max-w-5xl flex-col gap-4 w-full mx-auto p-4 mb-8"
id="tracks"
>
<div className="flex w-full gap-4 justify-between items-center flex-col md:flex-row">
Expand Down Expand Up @@ -224,42 +217,6 @@ export const Tracks = ({ tracks, categories }: TracksWithCategoriesProps) => {
</div>
</div>
)}
{/* Pagination Controls */}
<div className="flex justify-end items-end mt-4 w-full">
<Pagination>
<PaginationContent>
<PaginationItem className="cursor-pointer">
<PaginationPrevious
onClick={() => {
setCurrentPage((prev) => Math.max(prev - 1, 1));
}}
/>
</PaginationItem>
{Array.from({ length: totalPages }).map((_, index) => (
<PaginationItem key={index} className="cursor-pointer">
<PaginationLink onClick={() => setCurrentPage(index + 1)}>{index + 1}</PaginationLink>
</PaginationItem>
))}
{totalPages > 5 && (
<>
<PaginationItem>
<PaginationEllipsis />
</PaginationItem>
</>
)}

<PaginationItem
className="cursor-pointer"
>
<PaginationNext
onClick={() => {
setCurrentPage((prev) => Math.min(prev + 1, totalPages));
}}
/>
</PaginationItem>
</PaginationContent>
</Pagination>
</div>
</motion.div>
);
};