Skip to content

Commit c062951

Browse files
committed
profile for collapsed view: make more robust
1 parent 10be0d4 commit c062951

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/sidebar/MobileSidebar.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,12 @@ function SmallSearchView(props: { points: QueryPoint[]; selectedProfile: Routing
101101
const from = props.points[0]
102102
const to = props.points[props.points.length - 1]
103103
const isSmallHeight = useMediaQuery({ query: '(max-height: 36rem)' })
104-
let icon = icons[props.selectedProfile.name]
104+
const icon = icons[props.selectedProfile.name]
105+
const iconElement = icon ? React.createElement(icon) : React.createElement(icons.question_mark)
105106

106107
return (
107108
<div className={styles.btnOpenContainer} onClick={props.onClick}>
108-
<div className={styles.profile}>{React.createElement(icon)}</div>
109+
<div className={styles.profile}>{iconElement}</div>
109110
<div className={styles.mapView}>
110111
{!isSmallHeight && <SmallQueryPoint text={from.queryText} color={from.color} position={from.type} />}
111112
{!isSmallHeight && <IntermediatePoint points={props.points} />}

0 commit comments

Comments
 (0)