Skip to content

Commit

Permalink
Use && for conditional rendering
Browse files Browse the repository at this point in the history
This is a bit simpler than the ternary operator.
  • Loading branch information
victorlin committed Sep 12, 2023
1 parent 07c77f4 commit df16c51
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/controls/controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,27 +59,27 @@ function Controls({ mapOn, frequenciesOn, measurementsOn, mobileDisplay }: Props
<ChooseExplodeAttr tooltip={ExplodeTreeInfo} mobile={mobileDisplay} />
<ToggleTangle />

{measurementsOn ? (
{measurementsOn &&
<span style={{ marginTop: "10px" }}>
<AnnotatedHeader title={t("sidebar:Measurements Options")} tooltip={MeasurementsOptionsInfo} mobile={mobileDisplay}/>
<MeasurementsOptions />
</span>
) : null}
}

{mapOn ? (
{mapOn &&
<span style={{ marginTop: "10px" }}>
<AnnotatedHeader title={t("sidebar:Map Options")} tooltip={MapOptionsInfo} mobile={mobileDisplay}/>
<GeoResolution />
<TransmissionLines />
</span>
) : null}
}

{frequenciesOn ? (
{frequenciesOn &&
<span style={{ marginTop: "10px" }}>
<AnnotatedHeader title={t("sidebar:Frequency Options")} tooltip={FrequencyInfo} mobile={mobileDisplay}/>
<NormalizeFrequencies />
</span>
) : null}
}

<span style={{ marginTop: "10px" }}>
<AnnotatedHeader title={t("sidebar:Animation Options")} tooltip={AnimationOptionsInfo} mobile={mobileDisplay}/>
Expand Down

0 comments on commit df16c51

Please sign in to comment.