forked from WeonTrip-WonT/WonT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: TripAccommodation 페이지 - 1차 기능 구현 완료
- LocalItem: Tour API Read 데이터(위치기반 숙소정보) - SelectItem: 선택된 숙소 정보 - 그 외 AccommodationStore 내 selectedAccommodation(선택된 숙소 정보 storage) 이용한 정보 렌더링 Related to WeonTrip-WonT#55
- Loading branch information
Showing
6 changed files
with
171 additions
and
30 deletions.
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 |
---|---|---|
@@ -1,22 +1,44 @@ | ||
import Image from "next/image"; | ||
|
||
type DefaultImageProps = { | ||
size?: string; | ||
width?: string; | ||
heigth?: string; | ||
title?: string; | ||
src?: string; | ||
}; | ||
|
||
const DefaultImage = ({ size }: DefaultImageProps) => { | ||
return ( | ||
<div | ||
className={`flex justify-center align-middle w-[${size}] h-[${size}] rounded-[0.625rem] bg-[#EFF2F6]roun`} | ||
> | ||
const DefaultImage = ({ | ||
width = "w-14", | ||
heigth = "h-14", | ||
title, | ||
src, | ||
}: DefaultImageProps) => { | ||
if (src) { | ||
return ( | ||
<Image | ||
src="svg/default-image.svg" | ||
alt="기본 이미지" | ||
width={10} | ||
height={10} | ||
src={src} | ||
alt={title!} | ||
width="700" | ||
height="425" | ||
className="w-14 h-14 object-cover rounded-xl group-hover:sm:w-40 group-hover:sm:h-40" | ||
//TODO@uniS2: 모바일 touch 처리 예정 | ||
// https://ykwan0714.github.io/%ED%84%B0%EC%B9%98-%EB%94%94%EB%B0%94%EC%9D%B4%EC%8A%A4-%EB%AA%A8%EB%B0%94%EC%9D%BC%EC%97%90%EC%84%9C-hover-%EC%A0%9C%EA%B1%B0%ED%95%98%EA%B8%B0/ | ||
/> | ||
</div> | ||
); | ||
); | ||
} else { | ||
return ( | ||
<div | ||
className={`flex justify-center align-middle min-w-14 ${width} ${heigth} rounded-xl bg-[#EFF2F6]`} | ||
> | ||
<Image | ||
src="svg/default-image.svg" | ||
alt="기본 이미지" | ||
width={10} | ||
height={10} | ||
/> | ||
</div> | ||
); | ||
} | ||
}; | ||
|
||
export default DefaultImage; |
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,57 @@ | ||
import { BsFillPlusCircleFill } from "react-icons/bs"; | ||
import { FaCheckCircle } from "react-icons/fa"; | ||
import DefaultImage from "@/components/common/DefaultImage"; | ||
import { AccommodationStore } from "@/store/AccommodationStore"; | ||
|
||
type LocalItemProps = { | ||
id: number; | ||
title: string; | ||
addr: string; | ||
imgSrc: string; | ||
}; | ||
|
||
const LocalItem = ({ id, title, addr, imgSrc }: LocalItemProps) => { | ||
const { selectedAccommodation, setToggleAccommodation } = | ||
AccommodationStore(); | ||
const isSelected = Boolean( | ||
selectedAccommodation?.filter( | ||
(accommodation) => accommodation.contentid == id, | ||
).length, | ||
); | ||
|
||
return ( | ||
<li className="group flex gap-3 p-3 items-center w-full bg-white rounded-xl"> | ||
<DefaultImage src={imgSrc} /> | ||
<div className="w-full"> | ||
<p className="text-sm group-hover:sm:text-base group-hover:sm:font-semibold text-contentSecondary"> | ||
{title || "장소 이름이 정확하지 않습니다."} | ||
</p> | ||
<p className="text-xs group-hover:sm:text-sm text-point"> | ||
{addr || "주소가 정확하지 않습니다."} | ||
</p> | ||
</div> | ||
<button | ||
type="button" | ||
onClick={() => { | ||
setToggleAccommodation(id); | ||
}} | ||
> | ||
{isSelected ? ( | ||
<FaCheckCircle | ||
size="1.5625rem" | ||
color="#63D4F2" | ||
title="장소 선택 취소하기" | ||
/> | ||
) : ( | ||
<BsFillPlusCircleFill | ||
size="1.5625rem" | ||
color="#777777" | ||
title="장소 선택하기" | ||
/> | ||
)} | ||
</button> | ||
</li> | ||
); | ||
}; | ||
|
||
export default LocalItem; |
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