import type { Meta, StoryObj } from '@storybook/nextjs-vite'; import { useState } from 'react'; import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, } from '../components/pagination'; const meta = { title: 'UI/Pagination', component: Pagination, argTypes: { currentPage: { control: { type: 'number', min: 1 }, }, totalPages: { control: { type: 'number', min: 1 }, }, }, } satisfies Meta; export default meta; type Story = StoryObj; /** * Default pagination with 10 pages. */ export const Default: Story = { args: { currentPage: 1, totalPages: 10, onPageChange: () => {}, }, }; /** * Pagination on first page. */ export const FirstPage: Story = { args: { currentPage: 1, totalPages: 10, onPageChange: () => {}, }, }; /** * Pagination in the middle. */ export const MiddlePage: Story = { args: { currentPage: 5, totalPages: 10, onPageChange: () => {}, }, }; /** * Pagination on last page. */ export const LastPage: Story = { args: { currentPage: 10, totalPages: 10, onPageChange: () => {}, }, }; /** * Pagination with few pages (no ellipsis). */ export const FewPages: Story = { args: { currentPage: 2, totalPages: 3, onPageChange: () => {}, }, }; /** * Pagination with single page. */ export const SinglePage: Story = { args: { currentPage: 1, totalPages: 1, onPageChange: () => {}, }, }; /** * Pagination with many pages. */ export const ManyPages: Story = { args: { currentPage: 50, totalPages: 100, onPageChange: () => {}, }, }; /** * Interactive pagination with state. */ export const Interactive: Story = { args: { currentPage: 1, totalPages: 10, onPageChange: () => {}, }, render: function InteractivePagination() { const [page, setPage] = useState(1); return (

Current page: {page} of 10

); }, }; /** * Interactive pagination with many pages. */ export const InteractiveManyPages: Story = { args: { currentPage: 1, totalPages: 50, onPageChange: () => {}, }, render: function InteractiveManyPages() { const [page, setPage] = useState(1); return (

Current page: {page} of 50

); }, }; /** * Composable pagination using individual components. */ export const Composable: Story = { args: { currentPage: 3, totalPages: 10, onPageChange: () => {}, }, render: () => ( ), }; /** * All pagination states showcase. */ export const AllStates: Story = { args: { currentPage: 1, totalPages: 10, onPageChange: () => {}, }, render: () => (

First page (1 of 10)

{}} />

Middle page (5 of 10)

{}} />

Last page (10 of 10)

{}} />

Few pages (2 of 3)

{}} />

Many pages (50 of 100)

{}} />
), };