From ddc6788375539fcaef2a666982f2e8f88d22d345 Mon Sep 17 00:00:00 2001 From: Rafael Youakeem Date: Fri, 13 Sep 2024 19:33:43 +0200 Subject: [PATCH] Update Price component to Vanilla-Extract --- apps/store/src/components/Price.tsx | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/apps/store/src/components/Price.tsx b/apps/store/src/components/Price.tsx index 49794769d1..96d61bfd26 100644 --- a/apps/store/src/components/Price.tsx +++ b/apps/store/src/components/Price.tsx @@ -1,10 +1,10 @@ -import styled from '@emotion/styled' +import clsx from 'clsx' import type { ComponentProps } from 'react' -import { Text, theme } from 'ui' +import { Text, xStack } from 'ui' import type { CurrencyCode } from '@/services/graphql/generated' import { useFormatter } from '@/utils/useFormatter' -type Props = { +type Props = ComponentProps<'div'> & { currencyCode: CurrencyCode amount: number reducedAmount?: number @@ -16,31 +16,30 @@ type Props = { export const Price = ({ color = 'textPrimary', secondaryColor = 'textSecondary', + reducedAmount, + amount, + currencyCode, + className, ...props }: Props) => { const formatter = useFormatter() return ( - - {props.reducedAmount !== undefined && ( +
+ {reducedAmount !== undefined && ( {formatter.monthlyPrice({ - amount: props.amount, - currencyCode: props.currencyCode, + amount, + currencyCode, })} )} {formatter.monthlyPrice({ - currencyCode: props.currencyCode, - amount: props.reducedAmount ?? props.amount, + currencyCode, + amount: reducedAmount ?? amount, })} - +
) } - -const Wrapper = styled.div({ - display: 'flex', - columnGap: theme.space.xs, -})