Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/five-hounds-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@clerk/clerk-js': patch
'@clerk/types': patch
---

Simplify plan card avatar badge container styling.
49 changes: 20 additions & 29 deletions packages/clerk-js/src/ui/components/PricingTable/PlanCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,12 @@ export const PlanCardHeader = React.forwardRef<HTMLDivElement, PlanCardHeaderPro
elementDescriptor={descriptors.planCardAvatarBadgeContainer}
sx={t => ({
marginBlockEnd: t.space.$3,
...(!avatarUrl && !isActiveForPayer
? {
float: 'right',
}
: {
display: 'grid',
gridTemplateColumns: 'repeat(2, minmax(0,1fr))',
alignItems: 'start',
justifyContent: 'space-between',
gap: t.space.$3,
}),
display: 'flex',
alignItems: 'flex-start',
justifyContent: 'space-between',
flexWrap: 'wrap',
gap: t.space.$3,
float: !avatarUrl && !isActiveForPayer ? 'right' : undefined,
})}
>
{avatarUrl ? (
Expand All @@ -189,28 +184,24 @@ export const PlanCardHeader = React.forwardRef<HTMLDivElement, PlanCardHeaderPro
initials={name[0]}
rounded={false}
imageUrl={avatarUrl}
sx={{
gridRowStart: 1,
}}
/>
) : null}
<ReversibleContainer reverse={avatarUrl && closeSlot ? true : false}>
<ReversibleContainer reverse={!avatarUrl}>
{closeSlot}
{isActiveForPayer ? (
<Badge
localizationKey={localizationKeys('badge__currentPlan')}
colorScheme='secondary'
sx={
!avatarUrl
? {
justifySelf: 'start',
}
: {
justifySelf: avatarUrl && closeSlot ? 'start' : 'end',
}
}
/>
<Span
elementDescriptor={descriptors.planCardBadgeContainer}
sx={{
flexBasis: closeSlot && avatarUrl ? '100%' : undefined,
}}
>
<Badge
elementDescriptor={descriptors.planCardBadge}
localizationKey={localizationKeys('badge__currentPlan')}
colorScheme='secondary'
/>
</Span>
) : null}
{closeSlot}
</ReversibleContainer>
</Box>
) : null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ export const APPEARANCE_KEYS = containsAllElementsConfigKeys([
'planCardDescription',
'planCardAvatarBadgeContainer',
'planCardAvatar',
'planCardBadgeContainer',
'planCardBadge',
'planCardFeatures',
'planCardFeaturesList',
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/appearance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ export type ElementsConfig = {
planCardHeader: WithOptions;
planCardAvatarBadgeContainer: WithOptions;
planCardAvatar: WithOptions;
planCardBadgeContainer: WithOptions;
planCardBadge: WithOptions;
planCardTitle: WithOptions;
planCardDescription: WithOptions;
Expand Down