@@ -3,9 +3,10 @@ import Cancel from "../../assets/icon/close.svg?react";
3
3
import CautionIcon from "../../assets/icon/cautionText.svg?react" ;
4
4
import SafeIcon from "../../assets/icon/safeText.svg?react" ;
5
5
import DestinationIcon from "../../assets/icon/destination.svg?react" ;
6
+ import DangerIcon from "../../assets/icon/dangerText.svg?react" ;
6
7
import OriginIcon from "../../assets/icon/start.svg?react" ;
7
8
import ResultDivider from "../../assets/icon/resultDivider.svg?react" ;
8
- import { NavigationButtonRouteType , NavigationRouteList , NavigationRouteType } from "../../data/types/route" ;
9
+ import { NavigationButtonRouteType , NavigationRouteList } from "../../data/types/route" ;
9
10
import useRoutePoint from "../../hooks/useRoutePoint" ;
10
11
import { formatDistance } from "../../utils/navigation/formatDistance" ;
11
12
import { Link } from "react-router" ;
@@ -23,6 +24,7 @@ type TopBarProps = {
23
24
type AnimatedValueProps = {
24
25
value : number | string ;
25
26
className ?: string ;
27
+ children ?: React . ReactNode ;
26
28
} ;
27
29
28
30
const createTitle = ( buttonType : NavigationButtonRouteType ) => {
@@ -31,7 +33,7 @@ const createTitle = (buttonType: NavigationButtonRouteType) => {
31
33
if ( buttonType . includes ( "ELECTRIC" ) ) return "전동휠체어 예상소요시간" ;
32
34
} ;
33
35
34
- const AnimatedValue = ( { value, className } : AnimatedValueProps ) => {
36
+ const AnimatedValue = ( { value, className, children } : AnimatedValueProps ) => {
35
37
return (
36
38
< AnimatePresence mode = "wait" >
37
39
< motion . div
@@ -43,11 +45,24 @@ const AnimatedValue = ({ value, className }: AnimatedValueProps) => {
43
45
transition = { { duration : 0.2 } }
44
46
>
45
47
{ value }
48
+ { children }
46
49
</ motion . div >
47
50
</ AnimatePresence >
48
51
) ;
49
52
} ;
50
53
54
+ const returnTitleText = ( hasCaution : boolean , hasDanger : boolean ) => {
55
+ if ( hasDanger ) return "위험" ;
56
+ if ( hasCaution ) return "주의" ;
57
+ return "안전" ;
58
+ } ;
59
+
60
+ const returnIcon = ( hasCaution : boolean , hasDanger : boolean ) => {
61
+ if ( hasDanger ) return < DangerIcon /> ;
62
+ if ( hasCaution ) return < CautionIcon /> ;
63
+ return < SafeIcon /> ;
64
+ } ;
65
+
51
66
const NavigationDescription = ( { isDetailView, navigationRoute, buttonType, resetCurrentRouteIdx } : TopBarProps ) => {
52
67
const { origin, destination } = useRoutePoint ( ) ;
53
68
@@ -73,38 +88,53 @@ const NavigationDescription = ({ isDetailView, navigationRoute, buttonType, rese
73
88
) }
74
89
</ div >
75
90
< div className = "mt-4" > </ div >
76
- < div className = "w-full flex flex-row items-center justify-between space-x-4" >
77
- < div className = "flex flex-row items-center justify-center" >
78
- < AnimatedValue
79
- value = { navigationRoute ?. totalCost ? Math . floor ( navigationRoute . totalCost / 60 ) : " - " }
80
- className = "text-eng-heading1 font-bold font-[SF Pro Display] mr-0.5 pb-1"
81
- />
91
+ < div className = "w-full flex flex-row items-center justify-between ml-4" >
92
+ < div
93
+ className = { `w-full grid grid-cols-[14.2857%_auto_14.2857%_auto_71.4286%] items-center gap-x-2 ${ navigationRoute . totalCost / 60 >= 100 && "max-sm:ml-3" } ` }
94
+ >
95
+ < div className = "flex items-center justify-end" >
96
+ < AnimatedValue
97
+ value = { navigationRoute ?. totalCost ? Math . floor ( navigationRoute . totalCost / 60 ) : " - " }
98
+ className = { `flex flex-row text-eng-heading1 font-bold font-[SF Pro Display] mr-0.5 pb-1 gap-1 justify-end items-end ${ navigationRoute . totalCost / 60 >= 100 && "text-[28px] ml-1" } ` }
99
+ >
100
+ < div className = "flex items-baseline text-kor-heading1 h-full text-[16px] -mb-1 text-right" >
101
+ 분
102
+ </ div >
103
+ </ AnimatedValue >
104
+ </ div >
82
105
83
- < div className = "flex items-baseline text-kor-heading1 h-full text-[16px] -mb-1" > 분</ div >
84
- </ div >
85
- < div className = "h-[11px] border-[0.5px] border-gray-600" />
86
- < div className = "flex flex-row items-center justify-center truncate" >
87
- < AnimatedValue
88
- value = { navigationRoute ?. totalDistance ? formatDistance ( navigationRoute . totalDistance ) : " - m " }
89
- />
90
- </ div >
91
- < div className = "h-[11px] border-[0.5px] border-gray-600" />
92
- < div className = "flex flex-1 flex-row items-center justify-start " >
93
- { navigationRoute ? navigationRoute . hasCaution ? < CautionIcon /> : < SafeIcon /> : null }
94
- < span className = "ml-1 text-kor-body3 text-gray-700" >
95
- { navigationRoute
96
- ? `가는 길에 주의 요소가 ${ navigationRoute ?. hasCaution ? "있어요" : "없어요" } `
97
- : " 배리어프리 경로가 존재하지 않습니다. " }
98
- </ span >
106
+ < div className = "h-[11px] border-[0.5px] border-gray-600" />
107
+
108
+ < div className = "flex items-center justify-center truncate" >
109
+ < AnimatedValue
110
+ className = "text-kor-body3 text-gray-700"
111
+ value = {
112
+ navigationRoute ?. totalDistance ? formatDistance ( navigationRoute . totalDistance ) : " - m "
113
+ }
114
+ />
115
+ </ div >
116
+
117
+ < div className = "h-[11px] border-[0.5px] border-gray-600" />
118
+
119
+ < div className = "flex items-center justify-start" >
120
+ { returnIcon ( navigationRoute . hasCaution , navigationRoute . hasDanger ) }
121
+ < span className = "ml-1 text-kor-body3 text-gray-700 max-sm:text-xs" >
122
+ { navigationRoute
123
+ ? `가는 길에 ${ returnTitleText ( navigationRoute . hasCaution , navigationRoute . hasDanger ) } 요소가 ${
124
+ navigationRoute . hasCaution || navigationRoute . hasDanger ? "있어요" : "없어요"
125
+ } `
126
+ : " 배리어프리 경로가 존재하지 않습니다." }
127
+ </ span >
128
+ </ div >
99
129
</ div >
100
130
</ div >
101
131
< div className = "w-full flex flex-row items-center justify-between mt-4" >
102
- < div className = "flex-1 flex flex-row items-start justify-start" >
132
+ < div className = "flex-1 flex flex-row items-center justify-start" >
103
133
< OriginIcon />
104
134
< span className = "" > { origin ?. buildingName } </ span >
105
135
</ div >
106
136
< ResultDivider />
107
- < div className = "flex-1 flex flex-row items-start justify-start" >
137
+ < div className = "flex-1 flex flex-row items-center justify-start" >
108
138
< DestinationIcon />
109
139
< span > { destination ?. buildingName } </ span >
110
140
</ div >
0 commit comments