-
Notifications
You must be signed in to change notification settings - Fork 7
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
마이페이지 구현 #185
Merged
Merged
마이페이지 구현 #185
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b4eb07f
feat: 마이페이지 관련 타입추가
2e30ffe
feat: 마이페이지 관련 msw 데이터 및 핸들러 추가
e6b9574
feat: MyPage 페이지 컴포넌트 추가
c6916f1
feat: ProfileRunnerPostItem 컴포넌트 추가
dff0499
feat: ListFilter 컴포넌트 추가
e1fb1ab
feat: 마이페이지 페이지 라우팅 추가
817d221
refactor: list태그div에서ul로 수정
f1b4c9d
fix : 페이지 상수에 / 추가
8edb5e3
refactor: runnerProfile 타입명에 Get추가
f8149a5
refactor: Profile 타입을 따로 분리
9674644
refactor: iternator 명 수정
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 { ListSelectOption } from '@/types/select'; | ||
import React from 'react'; | ||
import styled, { css, keyframes } from 'styled-components'; | ||
|
||
interface Props { | ||
options: ListSelectOption[]; | ||
selectOption: (value: string | number) => void; | ||
width?: string; | ||
} | ||
|
||
const ListFilter = ({ options, selectOption, width }: Props) => { | ||
const makeHandleClickOption = (value: string | number) => () => { | ||
if (options.filter((option) => option.value === value).length === 0) return; | ||
|
||
selectOption(value); | ||
}; | ||
|
||
return ( | ||
<S.FilterContainer> | ||
<S.FilterList $width={width}> | ||
{options.map((item) => ( | ||
<S.FilterItem key={item.value} onClick={makeHandleClickOption(item.value)} isSelected={item.selected}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. map을 사용할 때 item보다는 option으로 넣는게 가독성이 좋을 것 같아요 |
||
{item.label} | ||
</S.FilterItem> | ||
))} | ||
</S.FilterList> | ||
</S.FilterContainer> | ||
); | ||
}; | ||
|
||
export default ListFilter; | ||
|
||
const appear = keyframes` | ||
0% { | ||
transform: scaleX(0); | ||
} | ||
100% { | ||
transform: scaleX(1); | ||
} | ||
`; | ||
|
||
const underLine = css` | ||
content: ''; | ||
margin-top: 5px; | ||
height: 3px; | ||
width: calc(100% + 10px); | ||
background-color: var(--baton-red); | ||
animation: 0.3s ease-in ${appear}; | ||
`; | ||
|
||
const S = { | ||
FilterContainer: styled.div``, | ||
|
||
FilterList: styled.ul<{ $width?: string }>` | ||
display: flex; | ||
justify-content: space-between; | ||
|
||
width: ${({ $width }) => $width ?? '920px'}; | ||
`, | ||
|
||
FilterItem: styled.li<{ isSelected: boolean }>` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
|
||
font-size: 26px; | ||
font-weight: 700; | ||
color: ${({ isSelected }) => (isSelected ? 'var(--baton-red)' : 'var(--gray-700)')}; | ||
|
||
&::after { | ||
${({ isSelected }) => (isSelected ? underLine : null)} | ||
} | ||
|
||
cursor: pointer; | ||
`, | ||
}; |
101 changes: 101 additions & 0 deletions
101
frontend/src/components/Profile/ProfileRunnerPostItem/ProfileRunnerPostItem.tsx
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,101 @@ | ||
import Button from '@/components/common/Button'; | ||
import Label from '@/components/common/Label'; | ||
import { REVIEW_STATUS_LABEL_TEXT } from '@/constants'; | ||
import { ProfileRunnerPost } from '@/types/profile'; | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
interface Props extends ProfileRunnerPost {} | ||
|
||
const ProfileRunnerPostItem = ({ runnerPostId, title, deadline, reviewStatus, tags }: Props) => { | ||
const handleClickFeedbackButton = () => { | ||
alert('준비중인 기능입니다'); | ||
}; | ||
|
||
return ( | ||
<S.RunnerPostItemContainer> | ||
<S.LeftSideContainer> | ||
<S.PostTitle>{title}</S.PostTitle> | ||
<S.DeadLineContainer> | ||
<S.DeadLine>{deadline} 까지</S.DeadLine> | ||
<Label colorTheme={reviewStatus === 'DONE' ? 'GRAY' : reviewStatus === 'IN_PROGRESS' ? 'RED' : 'WHITE'}> | ||
{REVIEW_STATUS_LABEL_TEXT[reviewStatus]} | ||
</Label> | ||
</S.DeadLineContainer> | ||
<S.TagContainer> | ||
{tags.map((tag, index) => ( | ||
<span key={index}>#{tag}</span> | ||
))} | ||
</S.TagContainer> | ||
</S.LeftSideContainer> | ||
<S.RightSideContainer> | ||
{reviewStatus === 'DONE' ? ( | ||
<Button | ||
colorTheme="WHITE" | ||
fontWeight={700} | ||
width={'180px'} | ||
height={'40px'} | ||
onClick={handleClickFeedbackButton} | ||
> | ||
피드백 작성 | ||
</Button> | ||
) : null} | ||
</S.RightSideContainer> | ||
</S.RunnerPostItemContainer> | ||
); | ||
}; | ||
|
||
export default ProfileRunnerPostItem; | ||
|
||
const S = { | ||
RunnerPostItemContainer: styled.li` | ||
display: flex; | ||
justify-content: space-between; | ||
|
||
width: 1200px; | ||
height: 206px; | ||
padding: 35px 40px; | ||
|
||
border: 0.5px solid var(--gray-500); | ||
border-radius: 12px; | ||
box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.2); | ||
|
||
cursor: pointer; | ||
`, | ||
|
||
PostTitle: styled.p` | ||
margin-bottom: 15px; | ||
|
||
font-size: 28px; | ||
font-weight: 700; | ||
`, | ||
|
||
DeadLineContainer: styled.div` | ||
display: flex; | ||
align-items: baseline; | ||
gap: 10px; | ||
`, | ||
|
||
DeadLine: styled.p` | ||
margin-bottom: 60px; | ||
|
||
color: var(--gray-600); | ||
`, | ||
|
||
TagContainer: styled.div` | ||
& span { | ||
margin-right: 10px; | ||
|
||
font-size: 14px; | ||
color: var(--gray-600); | ||
} | ||
`, | ||
|
||
LeftSideContainer: styled.div``, | ||
|
||
RightSideContainer: styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: end; | ||
`, | ||
}; |
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,31 @@ | ||
{ | ||
"profile": { | ||
"name": "도리토스", | ||
"imageUrl": "profile.jpg", | ||
"githubUrl": "github.com/shb03323", | ||
"introduction": "안녕하세요 디투입니다." | ||
}, | ||
"runnerPosts": [ | ||
{ | ||
"runnerPostId": 1, | ||
"title": "제목", | ||
"deadline": "마감기한", | ||
"tags": ["java", "JAVA"], | ||
"reviewStatus": "DONE" | ||
}, | ||
{ | ||
"runnerPostId": 2, | ||
"title": "제목2", | ||
"deadline": "마감기한2", | ||
"tags": ["java", "자바"], | ||
"reviewStatus": "NOT_STARTED" | ||
}, | ||
{ | ||
"runnerPostId": 3, | ||
"title": "제목3", | ||
"deadline": "마감기한3", | ||
"tags": ["java", "자바"], | ||
"reviewStatus": "NOT_STARTED" | ||
} | ||
] | ||
} |
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
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.
재활용하기 용이하겠군요 👍