Skip to content

Commit

Permalink
Merge pull request #44 from wafflestudio/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
SeohyunLilyChoi authored Jan 18, 2025
2 parents 52a7c90 + a026d20 commit 0810491
Show file tree
Hide file tree
Showing 28 changed files with 794 additions and 481 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
13 changes: 13 additions & 0 deletions src/components/common/constants/accommodationTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,79 +2,92 @@
import { RoomType } from '@/types/room';

type AccommodationType = {
type: string;
label: string;
imageUrl: string;
value: RoomType;
};

export const ACCOMMODATION_TYPES: AccommodationType[] = [
{
type: 'APARTMENT',
label: '아파트',
imageUrl:
'https://a0.muscache.com/pictures/4d7580e1-4ab2-4d26-a3d6-97f9555ba8f9.jpg',
value: RoomType.APARTMENT,
},
{
type: 'HOUSE',
label: '주택',
imageUrl:
'https://a0.muscache.com/pictures/732edad8-3ae0-49a8-a451-29a8010dcc0c.jpg',
value: RoomType.HOUSE,
},
{
type: 'VILLA',
label: '별장',
imageUrl:
'https://a0.muscache.com/pictures/3b1eb541-46d9-4bef-abc4-c37d77e3c21b.jpg',
value: RoomType.VILLA,
},
{
type: 'HANOK',
label: '한옥',
imageUrl:
'https://a0.muscache.com/pictures/51f5cf64-5821-400c-8033-8a10c7787d69.jpg',
value: RoomType.HANOK,
},
{
type: 'SWIMMING_POOL',
label: '수영장',
imageUrl:
'https://a0.muscache.com/pictures/3fb523a0-b622-4368-8142-b5e03df7549b.jpg',
value: RoomType.SWIMMING_POOL,
},
{
type: 'HOTEL',
label: '호텔',
imageUrl:
'https://a0.muscache.com/pictures/64b27fed-56a1-4f03-950a-d8da08efb428.jpg',
value: RoomType.HOTEL,
},
{
type: 'CAMPING',
label: '캠핑장',
imageUrl:
'https://a0.muscache.com/pictures/ca25c7f3-0d1f-432b-9efa-b9f5dc6d8770.jpg',
value: RoomType.CAMPING,
},
{
type: 'FARM',
label: '농장',
imageUrl:
'https://a0.muscache.com/pictures/aaa02c2d-9f0d-4c41-878a-68c12ec6c6bd.jpg',
value: RoomType.FARM,
},
{
type: 'COUNTRY_SIDE',
label: '시골',
imageUrl:
'https://a0.muscache.com/pictures/6ad4bd95-f086-437d-97e3-14d12155ddfe.jpg',
value: RoomType.COUNTRY_SIDE,
},
{
type: 'RIVER_SIDE',
label: '호숫가',
imageUrl:
'https://a0.muscache.com/pictures/bcd1adc0-5cee-4d7a-85ec-f6730b0f8d0c.jpg',
value: RoomType.RIVER_SIDE,
},
{
type: 'ISLAND',
label: '섬',
imageUrl:
'https://a0.muscache.com/pictures/8e507f16-4943-4be9-b707-59bd38d56309.jpg',
value: RoomType.ISLAND,
},
{
type: 'SKI',
label: '스키',
imageUrl:
'https://a0.muscache.com/pictures/8b44f770-7156-4c7b-b4d3-d92549c8652f.jpg',
Expand Down
8 changes: 4 additions & 4 deletions src/components/common/constants/icons/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { default as WifiIcon } from '@/assets/icons/amenities/wifi.svg';
export { default as CheckinIcon } from '@/assets/icons/amenities/checkin.svg';
export { default as LuggageIcon } from '@/assets/icons/amenities/luggage.svg';
export { default as TvIcon } from '@/assets/icons/amenities/tv.svg';
export { default as WifiIcon } from '@/assets/icons/roomdetail/wifi.svg';
export { default as CheckinIcon } from '@/assets/icons/roomdetail/checkin.svg';
export { default as LuggageIcon } from '@/assets/icons/roomdetail/luggage.svg';
export { default as TvIcon } from '@/assets/icons/roomdetail/tv.svg';
8 changes: 7 additions & 1 deletion src/components/home/context/SearchContext.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import type { ReactNode } from 'react';
import { createContext, useContext, useState } from 'react';

type ModalType = 'location' | 'calendar' | 'guests' | null;
type ModalType =
| 'location'
| 'calendar'
| 'guests'
| 'roomCalendar'
| 'roomGuests'
| null;

type Location = {
sido: string;
Expand Down
68 changes: 68 additions & 0 deletions src/components/roomdetail/HeartModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import PhotoSizeSelectActualIcon from '@mui/icons-material/PhotoSizeSelectActual';
import { useEffect } from 'react';

interface HeartModalProps {
onClose: () => void;
}

const mockHeart = [
{ name: '2025', itemsCount: 1 },
{ name: 'Dresden, Germany 2024', itemsCount: 24 },
{ name: 'Seoul 2024', itemsCount: 15 },
{ name: 'Kirribilli, Australia 2024', itemsCount: 4 },
];

const ShareModal = ({ onClose }: HeartModalProps) => {
useEffect(() => {
document.body.style.overflow = 'hidden'; // 배경 스크롤 비활성화
return () => {
document.body.style.overflow = 'auto'; // 모달 닫힐 때 스크롤 복원
};
}, []);

return (
<div className="fixed inset-0 bg-gray-900 bg-opacity-50 flex justify-center items-center z-50">
{/* 배경 클릭 시 닫힘 */}
<div
className="absolute inset-0 bg-black bg-opacity-50"
onClick={onClose}
></div>

{/* 모달 내용 */}
<div className="relative bg-white rounded-lg shadow-lg w-[40%] z-60 h-[80%] overflow-y-auto">
<div className="sticky top-0 bg-white flex items-center w-full border-b p-2">
<button
onClick={onClose}
className="text-left ml-2 text-3xl text-black"
>
&times;
</button>
<div className="text-base flex-1 text-center font-bold">
위시리스트에 저장하기
</div>
<div></div>
</div>
<div className="grid grid-cols-2 gap-2 px-2">
{mockHeart.map((list) => (
<div className="flex flex-col items-start p-2" key={list.name}>
<PhotoSizeSelectActualIcon className="text-white bg-gray-300 w-full h-[200px] rounded-md shadow-md" />
<p className="mt-2 text-base font-bold">{list.name}</p>
<p className="text-gray-500 text-sm">
저장된 항목&nbsp;{list.itemsCount}
</p>
</div>
))}
</div>

{/* "새로운 위시리스트 만들기" 버튼, 위치 고정 */}
<div className="sticky bottom-0 text-center bg-white border-t w-full">
<button className="w-full bg-gray-900 text-white text-base p-2 rounded-md m-3">
새로운 위시리스트 만들기
</button>
</div>
</div>
</div>
);
};

export default ShareModal;
63 changes: 25 additions & 38 deletions src/components/roomdetail/Info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import PhotoSizeSelectActualIcon from '@mui/icons-material/PhotoSizeSelectActual
import StarIcon from '@mui/icons-material/Star';
import { useState } from 'react';

import crownleft from '@/assets/icons/roomdetail/crownleft.svg';
import crownright from '@/assets/icons/roomdetail/crownright.svg';
import superhost from '@/assets/icons/superhost.svg';
import { ACCOMMODATION_TYPES } from '@/components/common/constants/accommodationTypes';
import crownleft from '@/components/roomdetail/crownleft.svg';
import crownright from '@/components/roomdetail/crownright.svg';
import ReviewModal from '@/components/roomdetail/ReviewModal';
import superhost from '@/components/roomdetail/superhost.svg';
import type { roomType } from '@/types/roomType';

import {
Expand All @@ -22,26 +22,27 @@ interface InfoProps {

const Info = ({ data }: InfoProps) => {
const matchingItem = ACCOMMODATION_TYPES.find(
(item) => item.label === data.type2,
(item) => item.type === data.roomType,
);
const issuperhost = data.superhost;
const isluggage = data.luggage;
const ischeckin = data.selfcheckin;
const iswifi = data.wifi;
const istv = data.tv;
const issuperhost = data.isSuperhost;
const isluggage = data.roomDetails.luggage;
const ischeckin = data.roomDetails.selfCheckin;
const iswifi = data.roomDetails.wifi;
const istv = data.roomDetails.tv;
const [isReviewOpen, setIsReviewOpen] = useState<boolean>(false);
return (
<div className="flex flex-col items-start w-full h-fit mt-8 pr-8">
<div className="w-full overflow-hidden text-xl break-words">
<span className="font-semibold">
{data.location.town}, {data.location.suburb},&nbsp;
{data.address.street}, {data.address.sigungu},&nbsp;
</span>
{data.location.country}&nbsp;{data.type1}
한국의&nbsp;{data.address.detail}
</div>
<div className="w-full overflow-hidden text-base break-words mt-1">
최대 인원&nbsp;{data.maxOccupancy}명&nbsp;&middot;&nbsp;침실&nbsp;
{data.bedroom}개&nbsp;&middot;&nbsp;침대&nbsp;{data.bed}
개&nbsp;&middot;&nbsp;욕실&nbsp;{data.bathroom}
{data.roomDetails.bedroom}개&nbsp;&middot;&nbsp;침대&nbsp;
{data.roomDetails.bed}
개&nbsp;&middot;&nbsp;욕실&nbsp;{data.roomDetails.bathroom}
</div>
<div className="flex justify-between border border-gray-300 rounded-md p-6 w-full my-8">
<div className="flex justify-center align-center gap-1 flex-1 border-r border-r-gray-300">
Expand All @@ -52,7 +53,7 @@ const Info = ({ data }: InfoProps) => {
<img src={crownright} className="basis-1/10" />
</div>
<div className="flex flex-col flex-1 items-center border-r border-r-gray-300">
<div>{data.avgrating}</div>
<div>{data.averageRating}</div>
<div className="flex">
<StarIcon className="" style={{ width: '10px', height: '10px' }} />
<StarIcon className="" style={{ width: '10px', height: '10px' }} />
Expand All @@ -62,7 +63,7 @@ const Info = ({ data }: InfoProps) => {
</div>
</div>
<div className="text-center flex-1">
<span className="font-semibold">{data.reviewcount}</span><br></br>
<span className="font-semibold">{data.reviewCount}</span><br></br>
<div
onClick={() => {
setIsReviewOpen(true);
Expand All @@ -80,7 +81,7 @@ const Info = ({ data }: InfoProps) => {
<img
src={matchingItem.imageUrl}
alt={matchingItem.label}
className="h-6 w-6 opacity-60 hover:opacity-100 transition-opacity"
className="h-6 w-6 opacity-60"
/>
<div className="opacity-60 text-sm">{matchingItem.label}</div>
</>
Expand All @@ -92,44 +93,29 @@ const Info = ({ data }: InfoProps) => {
)}
</div>
<div className="col-span-1 row-span-1 flex gap-2 items-center px-4">
<img
src={superhost}
className="h-6 w-6 opacity-60 hover:opacity-100 transition-opacity"
/>
<img src={superhost} className="h-6 w-6 opacity-60" />
<div className="opacity-60 text-sm">
{issuperhost ? '슈퍼호스트' : '훌륭한 호스트'}
</div>
</div>
<div className="col-span-1 row-span-1 flex gap-2 items-center px-4">
<img
src={LuggageIcon}
className="h-6 w-6 opacity-60 hover:opacity-100 transition-opacity"
/>
<img src={LuggageIcon} className="h-6 w-6 opacity-60" />
<div className="opacity-60 text-sm">
{isluggage ? '여행 가방 보관 가능' : '여행 가방 보관 풀가'}
</div>
</div>
<div className="col-span-1 row-span-1 flex gap-2 items-center px-4">
<img
src={CheckinIcon}
className="h-6 w-6 opacity-60 hover:opacity-100 transition-opacity"
/>
<img src={CheckinIcon} className="h-6 w-6 opacity-60" />
<div className="opacity-60 text-sm">
{ischeckin ? '셀프체크인' : '편의성이 뛰어난 체크인 절차'}
</div>
</div>
<div className="col-span-1 row-span-1 flex gap-2 items-center px-4">
<img
src={TvIcon}
className="h-6 w-6 opacity-60 hover:opacity-100 transition-opacity"
/>
<img src={TvIcon} className="h-6 w-6 opacity-60" />
<div className="opacity-60 text-sm">{istv ? 'TV' : 'TV 없음'}</div>
</div>
<div className="col-span-1 row-span-1 flex gap-2 items-center px-4">
<img
src={WifiIcon}
className="h-6 w-6 opacity-60 hover:opacity-100 transition-opacity"
/>
<img src={WifiIcon} className="h-6 w-6 opacity-60" />
<div className="opacity-60 text-sm">
{iswifi ? '와이파이' : '와이파이 없음'}
</div>
Expand All @@ -140,15 +126,16 @@ const Info = ({ data }: InfoProps) => {
<PhotoSizeSelectActualIcon className="text-white" />
</div>
<div>
<div>호스트: {data.host.username}&nbsp;님</div>
<div>호스트: {data.hostId}&nbsp;님</div>
<div className="text-sm text-gray-600">
{issuperhost ? '슈퍼호스트' : '훌륭한 호스트'}
</div>
</div>
</div>
<div className="w-full h-fit text-wrap px-4 py-8">{data.info}</div>
<div className="w-full h-fit text-wrap px-4 py-8">{data.description}</div>
{isReviewOpen && (
<ReviewModal
data={data}
onClose={() => {
setIsReviewOpen(false);
}}
Expand Down
Loading

0 comments on commit 0810491

Please sign in to comment.