Skip to content

Commit 1968bf5

Browse files
committed
chore(ui): Simplify component
1 parent 7648ea3 commit 1968bf5

1 file changed

Lines changed: 15 additions & 37 deletions

File tree

packages/ui/src/components/PricingTable/PricingTableDefault.tsx

Lines changed: 15 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,21 @@ const CardHeader = React.forwardRef<HTMLDivElement, CardHeaderProps>((props, ref
365365
>
366366
{feeFormatted}
367367
</Text>
368-
{!plan.isDefault ? <PlanPeriod plan={plan} /> : null}
368+
{!plan.isDefault ? (
369+
<Text
370+
elementDescriptor={descriptors.pricingTableCardFeePeriod}
371+
variant='caption'
372+
colorScheme='secondary'
373+
sx={t => ({
374+
textTransform: 'lowercase',
375+
':before': {
376+
content: '"/"',
377+
marginInlineEnd: t.space.$0x25,
378+
},
379+
})}
380+
localizationKey={plan.fee ? localizationKeys('billing.month') : localizationKeys('billing.year')}
381+
/>
382+
) : null}
369383
</Flex>
370384

371385
<PeriodToggle
@@ -377,42 +391,6 @@ const CardHeader = React.forwardRef<HTMLDivElement, CardHeaderProps>((props, ref
377391
);
378392
});
379393

380-
const PlanPeriod = ({ plan }: { plan: BillingPlanResource }) => {
381-
if (plan.fee) {
382-
return (
383-
<Text
384-
elementDescriptor={descriptors.pricingTableCardFeePeriod}
385-
variant='caption'
386-
colorScheme='secondary'
387-
sx={t => ({
388-
textTransform: 'lowercase',
389-
':before': {
390-
content: '"/"',
391-
marginInlineEnd: t.space.$0x25,
392-
},
393-
})}
394-
localizationKey={localizationKeys('billing.month')}
395-
/>
396-
);
397-
}
398-
399-
return (
400-
<Text
401-
elementDescriptor={descriptors.pricingTableCardFeePeriod}
402-
variant='caption'
403-
colorScheme='secondary'
404-
sx={t => ({
405-
textTransform: 'lowercase',
406-
':before': {
407-
content: '"/"',
408-
marginInlineEnd: t.space.$0x25,
409-
},
410-
})}
411-
localizationKey={localizationKeys('billing.year')}
412-
/>
413-
);
414-
};
415-
416394
const PeriodToggle = ({
417395
plan,
418396
planPeriod,

0 commit comments

Comments
 (0)