-
Notifications
You must be signed in to change notification settings - Fork 5
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] 새로운 방 비교 페이지를 퍼블리싱하고 비교 지도를 만든다. #958
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f501172
fix: 복구
ooherin aee63d6
Merge branch 'dev-fe' of https://github.com/woowacourse-teams/2024-ba…
ooherin e660e67
Merge branch 'dev-fe' of https://github.com/woowacourse-teams/2024-ba…
ooherin 67a544b
feat: 체크리스트 방 비교 타입 및 페이지 생성
ooherin ee18d85
feat: compare 페이지 1차 퍼블리싱
ooherin e9a625a
feat: 방 2개 마커 있는 지도 생성
ooherin 42a40f7
feat: 지도 roomMarker 해당 위치 이동 기능 생성
ooherin 275be8c
feat: 옵션 자세히 보기 모달 생성
ooherin 454da1c
feat: 옵션 모달 레이아웃 생성
ooherin 27cfb48
feat: 방 비교 체크리스트 디테일 모달 생성 및 라우트 연결
ooherin a7766a5
feat: 병합 충돌 해결
ooherin 982d21b
fix: 옵션 비교 모달 css 수정
ooherin fe25df7
feat: 지도 거리 유틸 분리 및 map 로직 일부 수정
ooherin 34b0b29
fix: 코드 리뷰 반영
ooherin 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
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
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions
19
frontend/src/components/RoomCompare/CategoryDetailModal.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,19 @@ | ||
import Modal from '@/components/_common/Modal/Modal'; | ||
|
||
interface Props { | ||
isOpen: boolean; | ||
closeModal: () => void; | ||
} | ||
|
||
const CategoryDetailModal = ({ isOpen, closeModal }: Props) => { | ||
return ( | ||
<Modal isOpen={isOpen} onClose={closeModal}> | ||
<Modal.header>카테고리 비교</Modal.header> | ||
<Modal.body> | ||
<div>카테고리 비교 내용이 들어갑니다.</div> | ||
</Modal.body> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default CategoryDetailModal; |
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,53 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
import FaceIcon from '@/components/_common/FaceIcon/FaceIcon'; | ||
import FlexBox from '@/components/_common/FlexBox/FlexBox'; | ||
import { MIN_GOOD_SCORE, MIN_SOSO_SCORE } from '@/constants/system'; | ||
import { boxShadow, flexCenter } from '@/styles/common'; | ||
|
||
interface Props { | ||
roomId: number; | ||
categoryId: number; | ||
score: number | null; | ||
openCategoryModal: (roomId: number, categoryId: number) => void; | ||
} | ||
|
||
const CategoryScore = ({ roomId, categoryId, score, openCategoryModal }: Props) => { | ||
const calcFaceIcon = (score: number | null) => { | ||
if (score === null) return 'NONE'; | ||
if (score >= MIN_GOOD_SCORE) return 'GOOD'; | ||
if (score >= MIN_SOSO_SCORE) return 'SOSO'; | ||
return 'BAD'; | ||
}; | ||
|
||
return ( | ||
<FlexBox.Vertical> | ||
<S.CategoryItemBox> | ||
<FaceIcon emotion={calcFaceIcon(score)} /> | ||
</S.CategoryItemBox> | ||
<S.CategoryItemBox> | ||
<S.Score onClick={() => openCategoryModal(roomId, categoryId)}>{score === null ? '-' : `${score}%`}</S.Score> | ||
</S.CategoryItemBox> | ||
</FlexBox.Vertical> | ||
); | ||
}; | ||
|
||
export default CategoryScore; | ||
|
||
const S = { | ||
CategoryItemBox: styled.div` | ||
width: 7rem; | ||
|
||
${flexCenter} | ||
text-align: center; | ||
`, | ||
Score: styled.span` | ||
width: 4rem; | ||
padding: 6px 8px; | ||
border: 1px solid ${({ theme }) => theme.palette.grey300}; | ||
|
||
font-size: ${({ theme }) => theme.text.size.small}; | ||
border-radius: 8px; | ||
${boxShadow} | ||
`, | ||
}; |
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,100 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
import SubwayStations from '@/components/_common/Subway/SubwayStations'; | ||
import CategoryScore from '@/components/RoomCompare/CategoryScore'; | ||
import CompareCardItem from '@/components/RoomCompare/CompareCardItem'; | ||
import { EMPTY_INDICATOR } from '@/constants/system'; | ||
import { boxShadow, flexColumn, title1, title4 } from '@/styles/common'; | ||
import { ChecklistCompare } from '@/types/checklistCompare'; | ||
|
||
interface Props { | ||
room: ChecklistCompare; | ||
index: number; | ||
openOptionModal: () => void; | ||
openCategoryModal: (roomId: number, categoryId: number) => void; | ||
} | ||
|
||
const CompareCard = ({ room, openOptionModal, openCategoryModal }: Props) => { | ||
return ( | ||
<S.Container> | ||
<CompareCardItem height={7} label={'주소'} item={<S.Item>{room.address}</S.Item>} /> | ||
<CompareCardItem label={'층수'} item={<S.Item>{room.floor ? `${room.floor}층` : EMPTY_INDICATOR}</S.Item>} /> | ||
<CompareCardItem | ||
label={'보증금 / 월세'} | ||
item={ | ||
<S.Item> | ||
{room.deposit ?? EMPTY_INDICATOR}/{room.rent ?? EMPTY_INDICATOR} | ||
</S.Item> | ||
} | ||
/> | ||
<CompareCardItem | ||
label={'방 구조 / 방 평수'} | ||
item={ | ||
<S.Item>{`${room.structure ?? EMPTY_INDICATOR}/${room.size ? `${room.size}평` : EMPTY_INDICATOR}`}</S.Item> | ||
} | ||
/> | ||
<CompareCardItem label={'계약기간'} item={<S.Item>{room.contractTerm}개월</S.Item>} /> | ||
<CompareCardItem | ||
label={'가까운 지하철'} | ||
item={<SubwayStations size={'small'} stations={room.nearSubwayStations} />} | ||
/> | ||
<CompareCardItem | ||
label={'옵션'} | ||
item={<S.OptionButton onClick={openOptionModal}>{room.options.length}개</S.OptionButton>} | ||
/> | ||
{/*카테고리별 질문 평점 섹션*/} | ||
{room.categories.map(category => ( | ||
<CompareCardItem | ||
key={category.categoryId} | ||
label={category.categoryName} | ||
item={ | ||
<CategoryScore | ||
roomId={room.checklistId} | ||
categoryId={category.categoryId} | ||
score={category.score} | ||
openCategoryModal={openCategoryModal} | ||
/> | ||
} | ||
/> | ||
))} | ||
</S.Container> | ||
); | ||
}; | ||
|
||
export default CompareCard; | ||
|
||
const S = { | ||
Container: styled.div` | ||
width: 100%; | ||
padding: 20px 4px; | ||
box-sizing: border-box; | ||
${flexColumn}; | ||
align-items: center; | ||
gap: 30px; | ||
`, | ||
RankWrapper: styled.div` | ||
${flexColumn} | ||
gap: 5px; | ||
`, | ||
Rank: styled.div` | ||
${title1} | ||
`, | ||
Item: styled.div` | ||
display: flex; | ||
width: 100%; | ||
|
||
font-size: ${({ theme }) => theme.text.size.small}; | ||
line-height: 1.5; | ||
letter-spacing: 0.05rem; | ||
text-align: center; | ||
justify-content: center; | ||
word-break: keep-all; | ||
`, | ||
OptionButton: styled.button` | ||
${title4} | ||
padding: 12px 16px; | ||
border: 1px solid ${({ theme }) => theme.palette.grey300}; | ||
border-radius: 8px; | ||
${boxShadow} | ||
`, | ||
}; |
51 changes: 51 additions & 0 deletions
51
frontend/src/components/RoomCompare/CompareCardCategoryItem.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,51 @@ | ||
import styled from '@emotion/styled'; | ||
import React from 'react'; | ||
|
||
import { flexCenter, flexColumn } from '@/styles/common'; | ||
|
||
interface Props { | ||
label?: string; | ||
isLabeled?: boolean; | ||
item: React.ReactNode; | ||
height?: number; | ||
score: number; | ||
} | ||
|
||
const CompareCardItem = ({ label, isLabeled = false, item, height, score }: Props) => { | ||
return ( | ||
<S.ItemContainer height={height}> | ||
<S.Label isLabeled={isLabeled}>{label}</S.Label> | ||
<S.ItemText>{item}</S.ItemText> | ||
<S.Score>{score}%</S.Score> | ||
</S.ItemContainer> | ||
); | ||
}; | ||
|
||
export default CompareCardItem; | ||
|
||
const S = { | ||
ItemContainer: styled.div<{ height?: number }>` | ||
width: 100%; | ||
height: ${({ height }) => height && height}rem; | ||
${flexColumn}; | ||
gap: 1rem; | ||
align-items: center; | ||
`, | ||
ItemText: styled.div` | ||
height: 100%; | ||
|
||
${flexCenter}; | ||
font-size: ${({ theme }) => theme.text.size.small}; | ||
line-height: 1.5rem; | ||
`, | ||
Score: styled.div` | ||
font-size: ${({ theme }) => theme.text.size.xSmall}; | ||
`, | ||
Label: styled.div<{ isLabeled: boolean }>` | ||
height: 1.5rem; | ||
margin-bottom: 0.5rem; | ||
|
||
color: ${({ theme }) => theme.palette.grey500}; | ||
font-size: ${({ theme }) => theme.text.size.xSmall}; | ||
`, | ||
}; |
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,49 @@ | ||
import styled from '@emotion/styled'; | ||
import React from 'react'; | ||
|
||
import { flexCenter, flexColumn } from '@/styles/common'; | ||
|
||
interface Props { | ||
label?: string; | ||
isLabeled?: boolean; | ||
item: React.ReactNode; | ||
height?: number; | ||
} | ||
|
||
const CompareCardItem = ({ label, isLabeled = false, item, height }: Props) => { | ||
return ( | ||
<S.ItemContainer height={height}> | ||
<S.Label isLabeled={isLabeled}>{label}</S.Label> | ||
<S.ItemText>{item}</S.ItemText> | ||
</S.ItemContainer> | ||
); | ||
}; | ||
|
||
export default CompareCardItem; | ||
|
||
const S = { | ||
ItemContainer: styled.div<{ height?: number }>` | ||
width: 100%; | ||
height: ${({ height }) => height && height}rem; | ||
${flexColumn}; | ||
gap: 1rem; | ||
align-items: center; | ||
`, | ||
ItemText: styled.div` | ||
height: 100%; | ||
|
||
${flexCenter}; | ||
font-size: ${({ theme }) => theme.text.size.small}; | ||
line-height: 1.5rem; | ||
`, | ||
Score: styled.div` | ||
font-size: ${({ theme }) => theme.text.size.xSmall}; | ||
`, | ||
Label: styled.div<{ isLabeled: boolean }>` | ||
height: 1.5rem; | ||
margin-bottom: 0.5rem; | ||
|
||
color: ${({ theme }) => theme.palette.grey500}; | ||
font-size: ${({ theme }) => theme.text.size.xSmall}; | ||
`, | ||
}; |
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.
ㅎㅎㅎㅋㅋ죽지 않고 돌아온~~