Skip to content

Commit

Permalink
fix(clerk-js): Correctly display all badges email/phone (#1749)
Browse files Browse the repository at this point in the history
  • Loading branch information
panteliselef authored Sep 21, 2023
1 parent 40ea407 commit a2c7115
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 24 deletions.
5 changes: 5 additions & 0 deletions .changeset/breezy-countries-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/clerk-js': patch
---

Fixed a bug where the "Unverified" badge was missing on email or phone number fields when those where marked as "Primary"
27 changes: 15 additions & 12 deletions packages/clerk-js/src/ui/components/UserProfile/EmailSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,21 @@ const EmailAccordion = ({ email }: { email: EmailAddressResource }) => {
<UserProfileAccordion
title={email.emailAddress}
badge={
isPrimary ? (
<Badge
localizationKey={localizationKeys('badge__primary')}
textVariant={'extraSmallMedium'}
/>
) : !isVerified ? (
<Badge
localizationKey={localizationKeys('badge__unverified')}
colorScheme='danger'
textVariant={'extraSmallMedium'}
/>
) : undefined
<>
{isPrimary && (
<Badge
localizationKey={localizationKeys('badge__primary')}
textVariant={'extraSmallMedium'}
/>
)}
{!isVerified && (
<Badge
localizationKey={localizationKeys('badge__unverified')}
colorScheme='danger'
textVariant={'extraSmallMedium'}
/>
)}
</>
}
>
<Col gap={4}>
Expand Down
27 changes: 15 additions & 12 deletions packages/clerk-js/src/ui/components/UserProfile/PhoneSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,21 @@ const PhoneAccordion = ({ phone }: { phone: PhoneNumberResource }) => {
}
title={formattedPhone}
badge={
isPrimary ? (
<Badge
localizationKey={localizationKeys('badge__primary')}
textVariant={'extraSmallMedium'}
/>
) : !isVerified ? (
<Badge
localizationKey={localizationKeys('badge__unverified')}
colorScheme='danger'
textVariant={'extraSmallMedium'}
/>
) : undefined
<>
{isPrimary && (
<Badge
localizationKey={localizationKeys('badge__primary')}
textVariant={'extraSmallMedium'}
/>
)}
{!isVerified && (
<Badge
localizationKey={localizationKeys('badge__unverified')}
colorScheme='danger'
textVariant={'extraSmallMedium'}
/>
)}
</>
}
>
<Col gap={4}>
Expand Down

0 comments on commit a2c7115

Please sign in to comment.