import * as React from 'react'
import {
ChevronLeftIcon,
ChevronRightIcon,
MoreHorizontalIcon,
} from 'lucide-react'
import { cn } from '@/lib/utils'
import { Button, buttonVariants } from '@/components/ui/button'
function Pagination({ className, ...props }: React.ComponentProps<'nav'>) {
return (
)
}
function PaginationContent({
className,
...props
}: React.ComponentProps<'ul'>) {
return (
)
}
function PaginationItem({ ...props }: React.ComponentProps<'li'>) {
return
}
type PaginationLinkProps = {
isActive?: boolean
isDisabled?: boolean
} & Pick, 'size'> &
React.ComponentProps<'a'>
function PaginationLink({
className,
isActive,
isDisabled,
size = 'icon',
...props
}: PaginationLinkProps) {
return (
)
}
function PaginationPrevious({
className,
isDisabled,
...props
}: React.ComponentProps) {
return (
Previous
)
}
function PaginationNext({
className,
isDisabled,
...props
}: React.ComponentProps) {
return (
Next
)
}
function PaginationEllipsis({
className,
...props
}: React.ComponentProps<'span'>) {
return (
More pages
)
}
const PaginationComponent: React.FC = ({
currentPage,
totalPages,
baseUrl,
}) => {
const pages = Array.from({ length: totalPages }, (_, i) => i + 1)
const getPageUrl = (page: number) => {
if (page === 1) return baseUrl
return `${baseUrl}${page}`
}
return (
1 ? getPageUrl(currentPage - 1) : undefined}
isDisabled={currentPage === 1}
/>
{pages.map((page) => (
{page}
))}
{totalPages > 5 && (
)}
)
}
interface PaginationProps {
currentPage: number
totalPages: number
baseUrl: string
}
export default PaginationComponent
export {
Pagination,
PaginationContent,
PaginationLink,
PaginationItem,
PaginationPrevious,
PaginationNext,
PaginationEllipsis,
}