Skip to content

Commit

Permalink
fix: check if state exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Vilsol committed Oct 19, 2023
1 parent fbf3915 commit 2102898
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
export const { t } = getTranslate();
const textForState = state ?? ('Unknown' as CompatibilityState);
const classForState = (s: CompatibilityState): string => `mod-state-${s.toString().toLowerCase()}`;
</script>

<p class="{classForState(state)} mod-state">{$t(`compatibility-info.state.${state.toString().toLowerCase()}`)}</p>
{#if state}
<p class="{classForState(textForState)} mod-state">
{$t(`compatibility-info.state.${textForState.toString().toLowerCase()}`)}
</p>
{/if}

0 comments on commit 2102898

Please sign in to comment.