Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
51 changes: 31 additions & 20 deletions src/components/dateCourse/info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,41 @@ type TMealKey = keyof typeof Meal;
const isBudgetKey = (v: string): v is TBudgetKey => Object.prototype.hasOwnProperty.call(Budget, v);
const isTotalTimeKey = (v: string): v is TTotalTimeKey => Object.prototype.hasOwnProperty.call(TotalTime, v);
const isMealKey = (v: string): v is TMealKey => Object.prototype.hasOwnProperty.call(Meal, v);

export default function Info({ cashTag, locationTag, timeTag, MealTag, keywordTags }: TInfo) {
const label = isBudgetKey(cashTag) ? Budget[cashTag] : '알 수 없음';
const totalTime = isTotalTimeKey(timeTag) ? TotalTime[timeTag] : '알 수 없음';
const meals = MealTag.filter(isMealKey).map((tag) => Meal[tag]);
const label = cashTag != null && isBudgetKey(cashTag) ? Budget[cashTag] : '알 수 없음';
const totalTime = timeTag != null && isTotalTimeKey(timeTag) ? TotalTime[timeTag] : '알 수 없음';
const meals = MealTag !== null && MealTag.filter(isMealKey).map((tag) => Meal[tag]);

return (
<div className="w-full gap-[24px] flex flex-col">
<InfoElement title="예산" tags={label}>
<Cash stroke="#000000" />
</InfoElement>
<InfoElement title="장소" tags={locationTag}>
<Location stroke="#000000" />
</InfoElement>
<InfoElement title="총 시간" tags={totalTime}>
<Alarm stroke="#000000" />
</InfoElement>

<InfoElement title="식사 구성" tags={meals}>
<Spoon fill="#000000" />
</InfoElement>

<InfoElement title="키워드" tags={keywordTags}>
<Blub stroke="#000000" />
</InfoElement>
{cashTag && (
<InfoElement title="예산" tags={label}>
<Cash stroke="#000000" />
</InfoElement>
)}
{locationTag && (
<InfoElement title="장소" tags={locationTag}>
<Location stroke="#000000" />
</InfoElement>
)}
{timeTag && (
<InfoElement title="총 시간" tags={totalTime}>
<Alarm stroke="#000000" />
</InfoElement>
)}

{meals && (
<InfoElement title="식사 구성" tags={meals}>
<Spoon fill="#000000" />
</InfoElement>
)}

{keywordTags && (
<InfoElement title="키워드" tags={keywordTags}>
<Blub stroke="#000000" />
</InfoElement>
)}
</div>
);
}
5 changes: 4 additions & 1 deletion src/components/dateCourse/timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import Location from '@/assets/icons/Location_Blank.svg?react';

function Timeline({ end = false, image, name, placeCategoryResponseList, roadNameAddress, averagePrice, time, signatureDish }: TTimeline) {
const [open, setOpen] = useState(false);
const editTime = time != null ? time.split(':')[0] : '00';
const editMin = time != null ? time.split(':')[1] : '00';

return (
<div className="flex w-full gap-2 flex-col">
<div
Expand All @@ -20,7 +23,7 @@ function Timeline({ end = false, image, name, placeCategoryResponseList, roadNam
onClick={() => (end ? undefined : setOpen(!open))}
>
<div className="flex items-center h-full font-body2 select-none">
{time.split(':')[0]}:{time.split(':')[1]}
{editTime}:{editMin}
</div>
<div className="flex flex-1 h-full justify-center items-center">
<div className="rounded-full w-[5px] h-[5px] bg-default-gray-700" />
Expand Down