2022-02-09 18:40:40 +01:00
|
|
|
import {
|
|
|
|
Flex,
|
|
|
|
Heading,
|
|
|
|
List,
|
|
|
|
ListIcon,
|
|
|
|
ListItem,
|
|
|
|
Text,
|
|
|
|
useColorModeValue,
|
|
|
|
VStack,
|
|
|
|
} from '@chakra-ui/react'
|
|
|
|
import * as React from 'react'
|
2022-05-13 15:22:44 -07:00
|
|
|
import { CheckCircleIcon } from '../../../assets/icons/CheckCircleIcon'
|
2022-02-09 18:40:40 +01:00
|
|
|
import { Card, CardProps } from './Card'
|
|
|
|
|
|
|
|
export interface PricingCardData {
|
|
|
|
features: string[]
|
|
|
|
name: string
|
|
|
|
price: string
|
2022-05-13 15:22:44 -07:00
|
|
|
featureLabel?: string
|
2022-02-09 18:40:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
interface PricingCardProps extends CardProps {
|
|
|
|
data: PricingCardData
|
|
|
|
icon?: JSX.Element
|
|
|
|
button: React.ReactElement
|
|
|
|
}
|
|
|
|
|
|
|
|
export const PricingCard = (props: PricingCardProps) => {
|
2022-03-17 14:37:00 +01:00
|
|
|
const { data, icon, button, ...rest } = props
|
2022-02-09 18:40:40 +01:00
|
|
|
const { features, price, name } = data
|
2022-03-17 14:37:00 +01:00
|
|
|
const accentColor = useColorModeValue('blue.500', 'white')
|
2022-02-09 18:40:40 +01:00
|
|
|
|
|
|
|
return (
|
2022-03-17 14:37:00 +01:00
|
|
|
<Card rounded="xl" bgColor="gray.800" {...rest}>
|
2022-03-17 14:37:00 +01:00
|
|
|
<Flex justifyContent="space-between" flexDir="column" h="full">
|
|
|
|
<Flex flexDir="column">
|
|
|
|
<VStack spacing={6}>
|
|
|
|
{icon}
|
2022-05-13 15:22:44 -07:00
|
|
|
<Heading size="md" fontWeight="extrabold" color={rest.borderColor}>
|
2022-03-17 14:37:00 +01:00
|
|
|
{name}
|
|
|
|
</Heading>
|
|
|
|
</VStack>
|
|
|
|
<Flex
|
|
|
|
align="flex-end"
|
|
|
|
justify="center"
|
|
|
|
fontWeight="extrabold"
|
|
|
|
color={accentColor}
|
|
|
|
my="8"
|
|
|
|
>
|
|
|
|
<Heading size="2xl" fontWeight="inherit" lineHeight="0.9em">
|
|
|
|
{price}
|
|
|
|
</Heading>
|
|
|
|
{(price.includes('$') || price.includes('€')) && (
|
|
|
|
<Text fontWeight="inherit" fontSize="xl">
|
|
|
|
/ month
|
|
|
|
</Text>
|
|
|
|
)}
|
|
|
|
</Flex>
|
2022-05-13 15:22:44 -07:00
|
|
|
|
2022-03-17 14:37:00 +01:00
|
|
|
<List spacing="4" mb="8" maxW="30ch" mx="auto">
|
2022-05-13 15:22:44 -07:00
|
|
|
{data.featureLabel && (
|
|
|
|
<Text fontWeight="bold">{data.featureLabel}</Text>
|
|
|
|
)}
|
2022-03-17 14:37:00 +01:00
|
|
|
{features.map((feature, index) => (
|
|
|
|
<ListItem fontWeight="medium" key={index}>
|
|
|
|
<ListIcon
|
|
|
|
fontSize="xl"
|
2022-05-13 15:22:44 -07:00
|
|
|
as={CheckCircleIcon}
|
2022-03-17 14:37:00 +01:00
|
|
|
marginEnd={2}
|
|
|
|
color={accentColor}
|
2022-05-13 15:22:44 -07:00
|
|
|
fill={rest.borderColor}
|
2022-03-17 14:37:00 +01:00
|
|
|
/>
|
|
|
|
{feature}
|
|
|
|
</ListItem>
|
|
|
|
))}
|
|
|
|
</List>
|
|
|
|
</Flex>
|
|
|
|
|
|
|
|
{button}
|
2022-02-09 18:40:40 +01:00
|
|
|
</Flex>
|
|
|
|
</Card>
|
|
|
|
)
|
|
|
|
}
|