Skip to content

Commit

Permalink
Merge pull request #6 from imdaxsz/develop
Browse files Browse the repository at this point in the history
fix: Pagination 예외 처리 추가
  • Loading branch information
imdaxsz authored Jan 30, 2024
2 parents a1f7bfe + 1b804c9 commit da8a03b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function Pagination({
return (
<div className={styles.wrapper}>
<ul>
<li className={`${styles.move} ${noPrev && styles.visible}`}>
<li className={`${styles.move} ${noPrev && styles.invisible}`}>
<Link to={`${url}page=${start - 1}`}>이전</Link>
</li>
{[...Array(pageCount)].map((a, i) => (
Expand All @@ -54,7 +54,7 @@ export default function Pagination({
)}
</React.Fragment>
))}
<li className={`${styles.move} ${noNext && styles.visible}`}>
<li className={`${styles.move} ${noNext && styles.invisible}`}>
<Link to={`${url}page=${start + pageCount}`}>다음</Link>
</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/Recommend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function Recommend() {
</div>
<Pagination
totalItems={totalBooks}
currentPage={page ? parseInt(page) : 1}
currentPage={page && parseInt(page) > 0 ? parseInt(page) : 1}
pageCount={5}
itemCountPerPage={50}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/SearchResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function SearchResult() {
{!loading && (
<Pagination
totalItems={totalItems}
currentPage={page ? parseInt(page) : 1}
currentPage={page && parseInt(page) > 0 ? parseInt(page) : 1}
pageCount={5}
itemCountPerPage={50}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/styles/pagination.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
}
}

.visible {
.invisible {
visibility: hidden;
}

Expand Down

0 comments on commit da8a03b

Please sign in to comment.