Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/components/Pagination/Pagination.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const onPageChange = (page: number) => { ... };

### totalPage

전체 페이지 수를 의미하는 프로퍼티입니다. 2 미만의 값을 넣을 경우 에러가 발생합니다.<br />
전체 페이지 수를 의미하는 프로퍼티입니다. 1 미만의 값을 넣을 경우 에러가 발생합니다.<br />
`totalPage <= 5`일 때, 이전/다음 버튼은 생성되지 않습니다.

<Canvas of={PaginationStories.TotalPage} />
Expand Down
2 changes: 1 addition & 1 deletion src/components/Pagination/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { StyledButton, StyledNav } from './Pagination.style';
import { PaginationProps } from './Pagination.type';

export const Pagination = ({ totalPage, initialPage = 1, onPageChange }: PaginationProps) => {
if (totalPage <= 1) throw new Error('totalPage는 2 이상의 숫자여야 합니다.');
if (totalPage <= 0) throw new Error('totalPage는 1 이상의 숫자여야 합니다.');
if (initialPage > totalPage) throw new Error('initialPage는 totalPage보다 클 수 없습니다.');

const [currentPage, setCurrentPage] = useState(initialPage);
Expand Down