-
Notifications
You must be signed in to change notification settings - Fork 0
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
130-0feature/PaginationButton 컴포넌트 구현 #134
Open
bluedog129
wants to merge
7
commits into
main
Choose a base branch
from
130-feature/paginationbutton
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
fc6d196
Fix: 리스트를 렌더링할 때 각 항목에 고유한 key prop을 제공하도록 변경
bluedog129 7c7b288
Feat: PaginationButton 구현
bluedog129 7aaa91c
Refactor: 불필요한 주석, import 제거
bluedog129 0c8eeb6
Fix: isActive를 부모로 부터 받아오는 로직이 불필요하다 생각해서 현재 페이지 받아오는걸로 변경
bluedog129 8348b5c
Fix: 'onClick' prop을 'onClickPaginationButton'로 변경하여 의미 명확화
bluedog129 04f47bb
Refactor: 변수 및 함수 코드 적절하게 정리
bluedog129 67db642
Refactor: onClick함수 관련 최적화
bluedog129 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 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as S from './styles'; | ||
|
||
interface PaginationButtonProps { | ||
pageNumber: number; | ||
currentPage: number; | ||
onClickPaginationButton: (page: number) => void; | ||
} | ||
|
||
export const PaginationButton = ({ pageNumber, currentPage, onClickPaginationButton }: PaginationButtonProps) => { | ||
const isActive = pageNumber === currentPage; | ||
const onClick = (pageNumber: number) => () => onClickPaginationButton(pageNumber); | ||
|
||
return ( | ||
<S.PaginationButton $isActive={isActive} onClick={onClick(pageNumber)}> | ||
{pageNumber} | ||
</S.PaginationButton> | ||
); | ||
}; | ||
|
||
export default PaginationButton; |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import styled from 'styled-components'; | ||
|
||
interface StyledPaginationButtonProps { | ||
$isActive: boolean; | ||
} | ||
|
||
export const PaginationButton = styled.button<StyledPaginationButtonProps>` | ||
padding: 5px 8px; | ||
margin: 0 4px; | ||
border: none; | ||
border-radius: 4px; | ||
background-color: ${({ $isActive, theme }) => ($isActive ? theme.colors.primary : theme.colors.white)}; | ||
color: ${({ $isActive, theme }) => ($isActive ? theme.colors.white : theme.colors.black)}; | ||
cursor: pointer; | ||
`; | ||
|
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.
아래 함수 추가하시고, onClick 이벤트에
onClick={onClick(page)}
로 넣어주시면 될 거에요!