feat: storybook 생성

This commit is contained in:
2026-04-13 14:15:00 +09:00
parent b390777af0
commit 01bfc751f2
15 changed files with 1671 additions and 2 deletions

View File

@@ -0,0 +1,89 @@
import type { Meta, StoryObj } from '@storybook/react'
import { useState } from 'react'
import { Pagination } from './Pagination'
const meta = {
title: 'Components/Pagination',
component: Pagination,
argTypes: {
totalPages: { control: 'number' },
currentPage: { control: 'number' },
pageCount: { control: 'number' },
},
} satisfies Meta<typeof Pagination>
export default meta
type Story = StoryObj<typeof meta>
export const Default: Story = {
args: {
totalPages: 100,
currentPage: 0,
pageCount: 10,
onPageChange: () => {},
},
}
export const MiddlePage: Story = {
args: {
totalPages: 100,
currentPage: 45,
pageCount: 10,
onPageChange: () => {},
},
}
export const LastPage: Story = {
args: {
totalPages: 100,
currentPage: 99,
pageCount: 10,
onPageChange: () => {},
},
}
export const FewPages: Story = {
args: {
totalPages: 5,
currentPage: 0,
pageCount: 10,
onPageChange: () => {},
},
}
export const SinglePage: Story = {
args: {
totalPages: 1,
currentPage: 0,
pageCount: 10,
onPageChange: () => {},
},
}
export const Interactive: Story = {
render: () => {
const [currentPage, setCurrentPage] = useState(0)
return (
<div className="flex flex-col gap-4 items-center">
<Pagination
totalPages={50}
currentPage={currentPage}
pageCount={10}
onPageChange={setCurrentPage}
/>
<p className="text-sm text-dabeeo-gray-44">
: {currentPage + 1} / 50
</p>
</div>
)
},
}
export const CustomPageCount: Story = {
args: {
totalPages: 100,
currentPage: 0,
pageCount: 5,
onPageChange: () => {},
},
}