-
Notifications
You must be signed in to change notification settings - Fork 9
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
[Feat] 프로젝트 페이지네이션 + 반응형 작업 #286
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c2d20c2
feat: 프로젝트 페이지네이션 추가
99-zziy 55c2ec1
feat: 페이지네이션 gap 수정
99-zziy 7d7b04a
feat: 프로젝트 섹션 애니메이션 추가
99-zziy 45be75c
feat: style 수정
99-zziy 23b7201
feat: 반응형 작업 추가
99-zziy 35e444c
feat: 페이지네이션 반응형 작업
99-zziy e4bc43c
feat: sign 컴포넌트 반응형
99-zziy 37eb58e
feat: margin-top 수정
99-zziy 9a8f76f
feat: window size 체킹하는 방법 수정
99-zziy d9d5ff6
feat: 링크 새로운 탭으로 열리도록 수정
99-zziy 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { useId } from 'react'; | ||
import { css } from '@emotion/react'; | ||
|
||
import { mediaQuery } from '~/styles/media'; | ||
import { theme } from '~/styles/theme'; | ||
|
||
type PaginationProps = { | ||
handlePageClick: (clickedPage: number) => void; | ||
numberOfPages: number; | ||
currentPage: number; | ||
}; | ||
|
||
export function Pagination({ handlePageClick, numberOfPages, currentPage }: PaginationProps) { | ||
const id = useId(); | ||
|
||
return ( | ||
<> | ||
<ul css={listCss}> | ||
{[...new Array(numberOfPages)].map((_, i) => { | ||
return ( | ||
<li | ||
onClick={() => handlePageClick(i + 1)} | ||
css={listItemCss(currentPage === i + 1)} | ||
key={`page-${id}-${i + 1}`} | ||
> | ||
{i + 1} | ||
</li> | ||
); | ||
})} | ||
</ul> | ||
<div css={buttonWrapperCss}> | ||
{numberOfPages !== currentPage && ( | ||
<button css={moreCss} onClick={() => handlePageClick(currentPage + 1)}> | ||
더보기 | ||
</button> | ||
)} | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
const listCss = css` | ||
margin-top: 70px; | ||
display: flex; | ||
gap: 28px; | ||
justify-content: center; | ||
${theme.typos.pretendard.subTitle2}; | ||
&:hover { | ||
cursor: pointer; | ||
} | ||
${mediaQuery('mobile')} { | ||
display: none; | ||
} | ||
`; | ||
|
||
const buttonWrapperCss = css` | ||
display: flex; | ||
justify-content: center; | ||
`; | ||
|
||
const moreCss = css` | ||
display: none; | ||
font-size: 0.9rem; | ||
color: ${theme.colors.yellow500}; | ||
padding: 8px 24px; | ||
margin-top: 30px; | ||
font-weight: 700; | ||
${mediaQuery('mobile')} { | ||
display: block; | ||
} | ||
`; | ||
|
||
const listItemCss = (selected: boolean) => css` | ||
padding: 10px; | ||
color: ${selected ? theme.colors.yellow500 : theme.colors.white}; | ||
`; |
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 @@ | ||
export { Pagination } from './Pagination'; |
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,56 @@ | ||
import { Dispatch, SetStateAction } from 'react'; | ||
import { css } from '@emotion/react'; | ||
|
||
import { TAB_LIST } from '~/constant/project'; | ||
import { mediaQuery } from '~/styles/media'; | ||
import { theme } from '~/styles/theme'; | ||
|
||
type ProjectTabProps = { | ||
currentTab: string; | ||
setCurrentTab: Dispatch<SetStateAction<string>>; | ||
}; | ||
|
||
export function ProjectTab({ currentTab, setCurrentTab }: ProjectTabProps) { | ||
return ( | ||
<ul css={tabWrapperCss}> | ||
<li css={tabContainerCss}> | ||
{TAB_LIST.map(tab => ( | ||
<button | ||
key={tab} | ||
css={currentTab === tab ? activeTabCss : inActiveTabCss} | ||
onClick={() => setCurrentTab(tab)} | ||
> | ||
{tab} | ||
</button> | ||
))} | ||
</li> | ||
</ul> | ||
); | ||
} | ||
|
||
const tabWrapperCss = css` | ||
display: flex; | ||
`; | ||
|
||
const tabContainerCss = css` | ||
display: flex; | ||
`; | ||
|
||
const tabCss = css` | ||
${theme.typos.pretendard.subTitle2}; | ||
padding: 16px 24px; | ||
${mediaQuery('mobile')} { | ||
${theme.typos.pretendard.body2}; | ||
padding: 8px 16px; | ||
} | ||
`; | ||
|
||
const activeTabCss = css` | ||
${tabCss}; | ||
color: ${theme.colors.yellow500}; | ||
`; | ||
|
||
const inActiveTabCss = css` | ||
${tabCss}; | ||
color: ${theme.colors.white}; | ||
`; |
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 @@ | ||
export { ProjectTab } from './ProjectTab'; |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Variants } from 'framer-motion'; | ||
|
||
export const defaultEasing = [0.6, -0.05, 0.01, 0.99]; | ||
|
||
export const defaultFadeInVariants: Variants = { | ||
initial: { | ||
opacity: 0, | ||
y: 40, | ||
transition: { duration: 0.5, ease: defaultEasing }, | ||
willChange: 'opacity, transform', | ||
}, | ||
animate: { | ||
opacity: 1, | ||
y: 0, | ||
transition: { duration: 0.8, ease: defaultEasing }, | ||
willChange: 'opacity, transform', | ||
}, | ||
exit: { | ||
opacity: 0, | ||
y: 40, | ||
transition: { duration: 0.5, ease: defaultEasing }, | ||
willChange: 'opacity, transform', | ||
}, | ||
}; | ||
|
||
export const staggerHalf: Variants = { | ||
animate: { transition: { staggerChildren: 0.05 } }, | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
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.
새로운 탭으로 열리는게 더 사용성 좋다고 생각하는데 어떻게 생각하시나요??
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.
오 좋은것 같아요 수정할게요 !