-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix/#154/code
- Loading branch information
Showing
30 changed files
with
498 additions
and
391 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Deploy to S3 and CloudFront | ||
name: admin Deploy to S3 and CloudFront | ||
|
||
on: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Deploy to S3 and CloudFront | ||
name: admin Deploy to S3 and CloudFront | ||
|
||
on: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,65 @@ | ||
import React from 'react'; | ||
import Proptypes from 'prop-types'; | ||
import PropTypes from 'prop-types'; | ||
|
||
function PageButton({ | ||
startPage, | ||
endPage, | ||
currentPage, | ||
totalPages, | ||
handlePageChange, | ||
onPageChange, | ||
}) { | ||
const createPageButtons = () => | ||
Array.from({ length: endPage - startPage + 1 }).map((_, index) => { | ||
const pageIndex = startPage + index; | ||
return ( | ||
<button | ||
key={pageIndex} | ||
onClick={() => onPageChange(pageIndex)} | ||
className={`${currentPage === pageIndex ? 'text-detail-1-bold' : 'text-detail-1-regular'}`} | ||
> | ||
{pageIndex} | ||
</button> | ||
); | ||
}); | ||
|
||
return ( | ||
<div className="flex justify-center gap-2 mt-10"> | ||
{/* 10칸씩 이동하는 버튼*/} | ||
<button | ||
onClick={() => handlePageChange(Math.max(1, currentPage - 10))} | ||
disabled={1 === currentPage} | ||
onClick={() => onPageChange(Math.max(1, currentPage - 10))} | ||
disabled={currentPage === 1} | ||
> | ||
« {/* << 기호 */} | ||
«{/* << 기호 */} | ||
</button> | ||
<button | ||
onClick={() => handlePageChange(currentPage - 1)} | ||
onClick={() => onPageChange(currentPage - 1)} | ||
disabled={currentPage === 1} | ||
> | ||
< | ||
</button> | ||
{Array.from({ length: endPage - startPage + 1 }).map((_, index) => ( | ||
<button | ||
key={index} | ||
onClick={() => handlePageChange(startPage + index)} | ||
className={`${ | ||
currentPage === startPage + index ? 'font-bold' : 'font-normal' | ||
}`} | ||
> | ||
{startPage + index} | ||
</button> | ||
))} | ||
{createPageButtons()} | ||
<button | ||
onClick={() => handlePageChange(currentPage + 1)} | ||
onClick={() => onPageChange(currentPage + 1)} | ||
disabled={currentPage === totalPages} | ||
> | ||
> | ||
</button> | ||
<button | ||
onClick={() => handlePageChange(Math.min(totalPages, currentPage + 10))} | ||
onClick={() => onPageChange(Math.min(totalPages, currentPage + 10))} | ||
disabled={currentPage === totalPages} | ||
> | ||
» {/* >> 기호 */} | ||
»{/* >> 기호 */} | ||
</button> | ||
</div> | ||
); | ||
} | ||
|
||
PageButton.propTypes = { | ||
startPage: Proptypes.number.isRequired, | ||
endPage: Proptypes.number.isRequired, | ||
currentPage: Proptypes.number.isRequired, | ||
totalPages: Proptypes.number.isRequired, | ||
handlePageChange: Proptypes.func.isRequired, | ||
startPage: PropTypes.number.isRequired, | ||
endPage: PropTypes.number.isRequired, | ||
currentPage: PropTypes.number.isRequired, | ||
totalPages: PropTypes.number.isRequired, | ||
onPageChange: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default PageButton; |
Oops, something went wrong.