Skip to content

Commit

Permalink
refactor: use conditionally render instead of && (#4620)
Browse files Browse the repository at this point in the history
For consistency and readability.
  • Loading branch information
thomasheartman authored Sep 6, 2023
1 parent caff040 commit 34d595b
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions frontend/src/component/feature/FeatureForm/FeatureForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,28 @@ const FeatureForm: React.FC<IFeatureToggleForm> = ({
<dd>
<code>{featureNaming?.pattern}</code>
</dd>
{Boolean(featureNaming?.example) && (
<>
<dt>Example</dt>
<dd>{featureNaming?.example}</dd>
</>
)}
{Boolean(featureNaming?.description) && (
<>
<dt>Description</dt>
<dd>{featureNaming?.description}</dd>
</>
)}
<ConditionallyRender
condition={Boolean(featureNaming?.example)}
show={
<>
<dt>Example</dt>
<dd>{featureNaming?.example}</dd>
</>
}
/>
<ConditionallyRender
condition={Boolean(
featureNaming?.description
)}
show={
<>
<dt>Description</dt>
<dd>
{featureNaming?.description}
</dd>
</>
}
/>
</dl>
</StyledFlagNamingInfo>
}
Expand Down

0 comments on commit 34d595b

Please sign in to comment.