Skip to content
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

[FE] refactor: ReviewCard에서 강점 키워드를 표시하는 ReviewKeyword 컴포넌트 분리 및 불필요한 예시 제거 #1039

Merged
merged 16 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
9ea0611
fix: 강점 키워드 데이터 서버 응답 형식과 통일
soosoo22 Jan 2, 2025
46488a1
feat: StrengthKeywordList 컴포넌트 생성
soosoo22 Jan 2, 2025
7ff2091
refactor: ReviewCard 폴더 위치 이동 및 디자인 수정
soosoo22 Jan 2, 2025
42bd98f
refactor: formattedCategories 함수 유틸로 분리 및 목록, 상세 페이지에 적용
soosoo22 Jan 2, 2025
3db5773
refactor: 작성일 표시 방식을 ReviewDate 컴포넌트를 사용하도록 변경
soosoo22 Jan 2, 2025
2078ac0
design: 상세 페이지 디자인 변경
soosoo22 Jan 2, 2025
679a8de
chore: 작성일 형식을 '-'에서 '.'으로 변경
soosoo22 Jan 2, 2025
330db3b
refactor: 배열을 처리하던 함수를 단일 문자열을 포맷팅하는 formatKeyword 함수로 변경
soosoo22 Jan 4, 2025
0a1fc8c
refactor: ReviewCard에서 강점 키워드를 표시하는 ReviewKeyword 컴포넌트 분리
soosoo22 Jan 4, 2025
5f81c4e
refactor: KeywordSection에서 MultipleChoiceAnswer 컴포넌트명으로 변경
soosoo22 Jan 4, 2025
70634cc
refactor: formatKeyword 함수에서 반환 타입을 명시하지 않도록 변경
soosoo22 Jan 4, 2025
27f0b9c
style: css 속성 정렬
soosoo22 Jan 4, 2025
8cf2414
refactor: QuestionAnswerSection을 질문과 답변(객관식/주관식) 구조로 변경
soosoo22 Jan 6, 2025
62eaf4c
refactor: MultilineTextViewer 상세 페이지 관련 컴포넌트로 폴더 위치 변경
soosoo22 Jan 6, 2025
33a44c4
refactor: 예시 포함 여부에 따라 포맷팅된 답변 또는 원본 답변 표시
soosoo22 Jan 6, 2025
541b890
refactor: MultilineTextViewer 컴포넌트 위치를 src/components/common/으로 복원
soosoo22 Jan 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/src/components/common/MultilineTextViewer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ interface MultilineTextViewerProps {

const MultilineTextViewer = ({ text }: MultilineTextViewerProps) => {
return (
<>
<S.MultilineTextContainer>
{text.split('\n').map((line, index) => (
<S.MultilineText key={index}>
{line}
<br />
</S.MultilineText>
))}
</>
</S.MultilineTextContainer>
);
};

Expand Down
14 changes: 14 additions & 0 deletions frontend/src/components/common/MultilineTextViewer/styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
import styled from '@emotion/styled';

export const MultilineTextContainer = styled.div`
overflow-y: auto;

box-sizing: border-box;
width: 100%;
height: 20rem;
padding: 1rem 1.5rem;

font-size: 1.6rem;
line-height: 2.4rem;

background-color: ${({ theme }) => theme.colors.lightGray};
`;

export const MultilineText = styled.div`
word-wrap: break-word;
`;
3 changes: 1 addition & 2 deletions frontend/src/components/common/OptionSwitch/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ export const OptionSwitchContainer = styled.ul`

width: 20rem;
height: 4.4rem;
margin-top: 0.9rem;
padding: 0.7rem;

background-color: ${({ theme }) => theme.colors.lightGray};
border-radius: ${({ theme }) => theme.borderRadius.basic};

margin-top: 0.9rem;

@media screen and (max-width: 530px) {
width: 100%;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { Category } from '@/types';

import ReviewDate from '../ReviewDate';
import ReviewKeyword from '../ReviewKeyword';

import * as S from './styles';

interface ReviewCardProps {
Expand All @@ -10,19 +13,21 @@ interface ReviewCardProps {
}

const ReviewCard = ({ createdAt, contentPreview, categories, handleClick }: ReviewCardProps) => {
const date = new Date(createdAt);

return (
<S.Layout onClick={handleClick}>
<S.Header>
<S.Date>{createdAt}</S.Date>
<ReviewDate date={date} dateTitle={`작성일`} />
</S.Header>
<S.Main>
<S.ContentPreview>{contentPreview}</S.ContentPreview>
<S.Footer>
<S.Keyword>
{categories.map((category) => (
<div key={category.optionId}>{category.content}</div>
<S.ReviewKeywordList>
{categories.map(({ optionId, content }) => (
<ReviewKeyword key={optionId} content={content} />
))}
</S.Keyword>
</S.ReviewKeywordList>
</S.Footer>
</S.Main>
</S.Layout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import media from '@/utils/media';
export const Layout = styled.div`
display: flex;
flex-direction: column;
border: 0.1rem solid ${({ theme }) => theme.colors.lightGray};
border: 0.2rem solid ${({ theme }) => theme.colors.disabled};
border-radius: 1rem;

&:hover {
cursor: pointer;
border: 0.15rem solid ${({ theme }) => theme.colors.primaryHover};
border: 0.2rem solid ${({ theme }) => theme.colors.primaryHover};

& > div:first-of-type {
background-color: ${({ theme }) => theme.colors.lightPurple};
& > div {
background-color: ${({ theme }) => theme.colors.palePurple};
}
}
`;
Expand All @@ -23,27 +23,22 @@ export const Header = styled.div`
align-items: center;

width: 100%;
height: 3.8rem;
padding: 2rem 0 0 2.5rem;

background-color: ${({ theme }) => theme.colors.lightGray};
border-radius: 1rem 1rem 0 0;
`;

export const Date = styled.p`
height: fit-content;
padding: 0 3rem;
font-size: 1.3rem;
`;

export const Main = styled.div`
display: flex;
flex-direction: column;
gap: 2rem;

width: 100%;
padding: 2rem 3rem;
padding: 2rem 2.5rem;

font-size: 1.6rem;

border-radius: 0 0 1rem 1rem;
`;

export const ContentPreview = styled.p`
Expand All @@ -52,10 +47,10 @@ export const ContentPreview = styled.p`
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;

height: 6rem;
height: 7.5rem;
padding-right: 2rem;

line-height: 2rem;
line-height: 2.5rem;
text-overflow: ellipsis;
overflow-wrap: break-word;
`;
Expand All @@ -73,21 +68,16 @@ export const Footer = styled.div`
}
`;

export const Keyword = styled.div`
export const ReviewKeywordList = styled.ul`
display: flex;
flex-wrap: wrap;
gap: 2.5rem;
align-items: center;

font-size: 1.4rem;
font-size: 1.2rem;
list-style-type: none;

${media.small} {
gap: 1.2rem;
}

div {
padding: 0.5rem 3rem;
background-color: ${({ theme }) => theme.colors.lightPurple};
border-radius: 0.8rem;
}
`;
9 changes: 2 additions & 7 deletions frontend/src/components/common/ReviewDate/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import ClockIcon from '@/assets/clock.svg';
import { formatDate } from '@/utils';

import * as S from './styles';
Expand All @@ -10,15 +9,11 @@ export interface ReviewDateProps {

const ReviewDate = ({ date, dateTitle }: ReviewDateProps) => {
const { year, month, day } = formatDate(date);

return (
<S.ReviewDate>
<S.ReviewDateText>
<S.ClockImg src={ClockIcon} alt="시계 아이콘" />
<span>{dateTitle}</span>
<S.Colon>:</S.Colon>
</S.ReviewDateText>
<span>
{year}-{month}-{day}
{dateTitle} | {year}.{month}.{day}
</span>
</S.ReviewDate>
);
Expand Down
22 changes: 2 additions & 20 deletions frontend/src/components/common/ReviewDate/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,13 @@ import styled from '@emotion/styled';

import media from '@/utils/media';

export const ReviewDateText = styled.div`
display: inline-flex;
align-items: center;
justify-content: center;

${media.small} {
display: none;
}
`;

export const ClockImg = styled.img`
width: auto;
height: 1.6rem;
margin-right: 0.8rem;
`;

export const ReviewDate = styled.div`
display: flex;
align-items: center;
font-weight: ${({ theme }) => theme.fontWeight.semibold};
color: ${({ theme }) => theme.colors.gray};

${media.xSmall} {
font-size: ${({ theme }) => theme.fontSize.small};
}
`;

export const Colon = styled.span`
margin: 0 1rem;
`;
11 changes: 11 additions & 0 deletions frontend/src/components/common/ReviewKeyword/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import formatKeyword from '@/utils/formatKeyword';

import * as S from './styles';

const ReviewKeyword = ({ content }: { content: string }) => {
const formattedKeyword = formatKeyword(content);

return <S.ReviewKeyword>{formattedKeyword}</S.ReviewKeyword>;
};

export default ReviewKeyword;
11 changes: 11 additions & 0 deletions frontend/src/components/common/ReviewKeyword/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import styled from '@emotion/styled';

export const ReviewKeyword = styled.li`
padding: 0.5rem 2rem;

font-weight: ${({ theme }) => theme.fontWeight.semibold};
color: ${({ theme }) => theme.colors.primary};

background-color: ${({ theme }) => theme.colors.lightPurple};
border-radius: 1.4rem;
`;
12 changes: 10 additions & 2 deletions frontend/src/mocks/mockData/detailedReviewMockData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,16 @@ export const DETAILED_REVIEW_MOCK_DATA: DetailReviewData = {
minCount: 1,
maxCount: 2,
options: [
{ optionId: 1, content: '🗣️ 커뮤니케이션, 협업 능력', isChecked: true },
{ optionId: 2, content: '💡 문제 해결 능력', isChecked: false },
{
optionId: 1,
content: '🗣️커뮤니케이션, 협업 능력 (예: 팀원간의 원활한 정보 공유, 명확한 의사소통)',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

목데이터와 실제 데이터가 같아졌네요! 헷갈렸는데 좋네요~~

isChecked: true,
},
{
optionId: 2,
content: '💡문제 해결 능력 (예: 프로젝트 중 만난 버그/오류를 분석하고 이를 해결하는 능력)',
isChecked: true,
},
],
},
},
Expand Down
Loading