-
Notifications
You must be signed in to change notification settings - Fork 1
✨ feat: 페이지네이션 구현 #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
569f574
🖼️ feat: 페이지네이션 아이콘4장 추가
697f61e
📁 chore : Pagination 컴포넌트 파일 생성
112bcbe
✨ feat: Pagination 컴포넌트 기본 구조 및 Props 적용
17f2bce
✨ feat: 페이지 번호 버튼 구현 및 Tailwind 스타일 적용
8a282a1
✨ feat: 이전/다음 버튼 포함 페이지네이션 기능 완성 및 Tailwind 스타일 적용
c8738a4
♻️ refactor: 오른쪽 회색 화살표 제거 및 마지막 페이지에서 화살표 숨김 처리
752294b
✨ feat: 페이지네이션 7개 단위 그룹으로 이동 구현
5385973
Merge branch 'develop' of https://github.com/codeit-6team/The-julge i…
f3b12ca
✨ feat: 페이지네이션 피드백 반영 후 수정
a313932
✨ feat: 페이지네이션 피드백 2차 반영
3bdfda4
✨feat : 페이지네이션 피드팩 2차 수정
124ae07
Merge branch 'develop' of https://github.com/codeit-6team/The-julge i…
8ebe3c0
Merge branch 'develop' of https://github.com/codeit-6team/The-julge i…
2e94368
✨feat:페이지네이션 2차 피드백 반영 후 수정
212604e
🎨style: 스타일 수정
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,7 +1,7 @@ | ||
| export default function App() { | ||
| return ( | ||
| <> | ||
| <h1 className="text-3xl font-bold underline">hi</h1> | ||
| </> | ||
| <div> | ||
| <h1>hi</h1> | ||
| </div> | ||
| ); | ||
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Moon-ju-young marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Moon-ju-young marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Moon-ju-young marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| import ArrowLeft from '../../../assets/icons/arrow-left.svg'; | ||
| import ArrowLeftGray from '../../../assets/icons/arrow-left-gray.svg'; | ||
| import ArrowRight from '../../../assets/icons/arrow-right.svg'; | ||
Moon-ju-young marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| interface Props { | ||
| totalPages: number; | ||
| currentPage: number; | ||
| onChangePage: (pageNumber: number) => void; | ||
Moon-ju-young marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| export default function Pagination({ | ||
| totalPages, | ||
| currentPage, | ||
| onChangePage, | ||
| }: Props) { | ||
| const groupSize = 7; | ||
| const currentGroup = Math.floor((currentPage - 1) / groupSize); | ||
| const groupStart = currentGroup * groupSize + 1; | ||
| const groupEnd = Math.min(groupStart + groupSize - 1, totalPages); | ||
|
|
||
| const renderPageNumbers = () => { | ||
| return Array.from( | ||
| { length: groupEnd - groupStart + 1 }, | ||
| (_, index) => groupStart + index, | ||
| ).map((pageNumber) => ( | ||
| <button | ||
| key={pageNumber} | ||
| type="button" | ||
| onClick={() => onChangePage(pageNumber)} | ||
| className={`w-10 h-10 rounded flex items-center justify-center text-sm ${ | ||
| currentPage === pageNumber | ||
| ? 'text-white font-bold' | ||
| : 'text-black hover:bg-gray-100' | ||
| }`} | ||
| style={{ | ||
| backgroundColor: currentPage === pageNumber ? '#FF8D72' : '#ffffff', | ||
| }} | ||
| > | ||
| {pageNumber} | ||
| </button> | ||
| )); | ||
| }; | ||
|
|
||
| return ( | ||
| <div className="flex items-center justify-center gap-4"> | ||
| {/* 이전 그룹 이동 */} | ||
| {totalPages > groupSize && groupStart > 1 && ( | ||
| <button type="button" onClick={() => onChangePage(groupStart - 1)}> | ||
| <img | ||
| src={groupStart - 1 === 1 ? ArrowLeftGray : ArrowLeft} | ||
| alt="이전 페이지 그룹" | ||
| className="w-5 h-5" | ||
| /> | ||
| </button> | ||
| )} | ||
|
|
||
| {/* 페이지 번호 */} | ||
| <div className="flex gap-1">{renderPageNumbers()}</div> | ||
|
|
||
| {/* 다음 그룹 이동 */} | ||
| {totalPages > groupSize && groupEnd < totalPages && ( | ||
| <button type="button" onClick={() => onChangePage(groupEnd + 1)}> | ||
| <img src={ArrowRight} alt="다음 페이지 그룹" className="w-5 h-5" /> | ||
| </button> | ||
| )} | ||
| </div> | ||
| ); | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❗ 해당 파일에서 충돌이 일어나는 이유가 최신 develop branch에서 merge를 안해와서 그런 것 같습니다~ pr merge 하기 전에 최신 변경사항 반영 해주세용