Skip to content

Commit

Permalink
Added Pagination Component to Storybook (#104)
Browse files Browse the repository at this point in the history
closes #100
  • Loading branch information
KushalNerella07 committed Oct 11, 2023
1 parent e0b61a7 commit 9ff104b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
47 changes: 47 additions & 0 deletions src/packages/Pagination/stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React, { useState, useEffect } from 'react'
import Pagination, { PaginationProps } from '.'

export default {
title: 'Pagination',
component: Pagination,
args: {
totalCount: 100,
currentPage: 1,
pageSize: 10,
siblingCount: 1,
colors: {
page: 'gray',
hover: 'blue'
}
}
}

const Template = (args: PaginationProps) => {
const [currentPage, setCurrentPage] = useState(args.currentPage)

useEffect(() => {
setCurrentPage(args.currentPage)
}, [args.currentPage])

return (
<Pagination
{...args}
currentPage={currentPage}
onPageChange={(page: number) => {
setCurrentPage(page)
}}
/>
)
}

export const Default = Template.bind({})
Default.args = {
totalCount: 100,
currentPage: 1,
pageSize: 10,
siblingCount: 1,
colors: {
page: 'gray',
hover: 'blue'
}
}
3 changes: 2 additions & 1 deletion src/packages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ export { default as Breadcrumb } from './Breadcrumb'
export { default as Skeleton } from './Skeleton'
export { default as Switch } from './Switch'
export { default as Table } from './Table'
// export { default as Pagination } from './Pagination' TODO: review pagination styles and logic
export { default as Pagination } from './Pagination'

0 comments on commit 9ff104b

Please sign in to comment.