@@ -16,30 +16,41 @@ type TMealKey = keyof typeof Meal;
1616const isBudgetKey = ( v : string ) : v is TBudgetKey => Object . prototype . hasOwnProperty . call ( Budget , v ) ;
1717const isTotalTimeKey = ( v : string ) : v is TTotalTimeKey => Object . prototype . hasOwnProperty . call ( TotalTime , v ) ;
1818const isMealKey = ( v : string ) : v is TMealKey => Object . prototype . hasOwnProperty . call ( Meal , v ) ;
19+
1920export default function Info ( { cashTag, locationTag, timeTag, MealTag, keywordTags } : TInfo ) {
20- const label = isBudgetKey ( cashTag ) ? Budget [ cashTag ] : '알 수 없음' ;
21- const totalTime = isTotalTimeKey ( timeTag ) ? TotalTime [ timeTag ] : '알 수 없음' ;
22- const meals = MealTag . filter ( isMealKey ) . map ( ( tag ) => Meal [ tag ] ) ;
21+ const label = cashTag != null && isBudgetKey ( cashTag ) ? Budget [ cashTag ] : '알 수 없음' ;
22+ const totalTime = timeTag != null && isTotalTimeKey ( timeTag ) ? TotalTime [ timeTag ] : '알 수 없음' ;
23+ const meals = MealTag !== null && MealTag . filter ( isMealKey ) . map ( ( tag ) => Meal [ tag ] ) ;
2324
2425 return (
2526 < div className = "w-full gap-[24px] flex flex-col" >
26- < InfoElement title = "예산" tags = { label } >
27- < Cash stroke = "#000000" />
28- </ InfoElement >
29- < InfoElement title = "장소" tags = { locationTag } >
30- < Location stroke = "#000000" />
31- </ InfoElement >
32- < InfoElement title = "총 시간" tags = { totalTime } >
33- < Alarm stroke = "#000000" />
34- </ InfoElement >
35-
36- < InfoElement title = "식사 구성" tags = { meals } >
37- < Spoon fill = "#000000" />
38- </ InfoElement >
39-
40- < InfoElement title = "키워드" tags = { keywordTags } >
41- < Blub stroke = "#000000" />
42- </ InfoElement >
27+ { cashTag && (
28+ < InfoElement title = "예산" tags = { label } >
29+ < Cash stroke = "#000000" />
30+ </ InfoElement >
31+ ) }
32+ { locationTag && (
33+ < InfoElement title = "장소" tags = { locationTag } >
34+ < Location stroke = "#000000" />
35+ </ InfoElement >
36+ ) }
37+ { timeTag && (
38+ < InfoElement title = "총 시간" tags = { totalTime } >
39+ < Alarm stroke = "#000000" />
40+ </ InfoElement >
41+ ) }
42+
43+ { meals && (
44+ < InfoElement title = "식사 구성" tags = { meals } >
45+ < Spoon fill = "#000000" />
46+ </ InfoElement >
47+ ) }
48+
49+ { keywordTags && (
50+ < InfoElement title = "키워드" tags = { keywordTags } >
51+ < Blub stroke = "#000000" />
52+ </ InfoElement >
53+ ) }
4354 </ div >
4455 ) ;
4556}
0 commit comments