Skip to content

Commit

Permalink
fix(elements): user ternary
Browse files Browse the repository at this point in the history
  • Loading branch information
louptheron committed Aug 20, 2024
1 parent 41fd6ae commit 223acde
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/elements/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ export function IconButton({
case Accent.SECONDARY:
return (
<>
{badgeNumber === undefined && <SecondaryButton as={StyledButton} {...buttonProps} />}
{badgeNumber !== undefined && (
{badgeNumber === undefined ? (
<SecondaryButton as={StyledButton} {...buttonProps} />
) : (
<Wrapper className={className} style={style}>
<BadgeNumber backgroundColor={badgeBackgroundColor} color={badgeColor} size={size}>
{badgeNumber}
Expand All @@ -98,8 +99,9 @@ export function IconButton({
case Accent.TERTIARY:
return (
<>
{badgeNumber === undefined && <TertiaryButton as={StyledButton} {...buttonProps} />}
{badgeNumber !== undefined && (
{badgeNumber === undefined ? (
<TertiaryButton as={StyledButton} {...buttonProps} />
) : (
<Wrapper className={className} style={style}>
<BadgeNumber backgroundColor={badgeBackgroundColor} color={badgeColor} size={size}>
{badgeNumber}
Expand All @@ -113,8 +115,9 @@ export function IconButton({
default:
return (
<>
{badgeNumber === undefined && <PrimaryButton as={StyledButton} {...buttonProps} />}
{badgeNumber !== undefined && (
{badgeNumber === undefined ? (
<PrimaryButton as={StyledButton} {...buttonProps} />
) : (
<Wrapper className={className} style={style}>
<BadgeNumber backgroundColor={badgeBackgroundColor} color={badgeColor} size={size}>
{badgeNumber}
Expand Down

0 comments on commit 223acde

Please sign in to comment.