2
0

✏️ (lp) Fix incorrect additional limits price

This commit is contained in:
Baptiste Arnaud
2022-11-03 19:39:42 +01:00
parent 570a780db1
commit c62e20f81a
26 changed files with 434 additions and 481 deletions

View File

@ -9,13 +9,15 @@ import {
VStack,
} from '@chakra-ui/react'
import * as React from 'react'
import { useEffect, useState } from 'react'
import { formatPrice } from 'utils'
import { CheckCircleIcon } from '../../../assets/icons/CheckCircleIcon'
import { Card, CardProps } from './Card'
export interface PricingCardData {
features: React.ReactNode[]
name: string
price: string
price: number | string
featureLabel?: string
}
@ -32,8 +34,13 @@ export const PricingCard = ({
...rest
}: PricingCardProps) => {
const { features, price, name } = data
const [formattedPrice, setFormattedPrice] = useState(price)
const accentColor = useColorModeValue('blue.500', 'white')
useEffect(() => {
setFormattedPrice(typeof price === 'number' ? formatPrice(price) : price)
}, [price])
return (
<Card rounded="xl" bgColor="gray.800" {...rest}>
<Flex justifyContent="space-between" flexDir="column" h="full">
@ -52,9 +59,9 @@ export const PricingCard = ({
my="8"
>
<Heading size="2xl" fontWeight="inherit" lineHeight="0.9em">
{price}
{formattedPrice}
</Heading>
{(price.includes('$') || price.includes('€')) && (
{typeof price === 'number' && (
<Text fontWeight="inherit" fontSize="xl">
/ month
</Text>