import { Check, Minus } from 'lucide-react'
import React, { type FC, type ReactNode } from 'react'
import { cn } from 'ui'
import { TextLink } from 'ui-patterns/TextLink'
import SectionContainer from '@/components/Layouts/SectionContainer'
export interface PricingComparisonPlan {
name: string
/** Highlights the column visually (eg. the recommended plan). */
highlight?: boolean
}
export interface PricingComparisonRow {
feature: ReactNode
/** One value per plan, in the same order as `plans`. Booleans render as a check or dash. */
values: (ReactNode | boolean)[]
}
export interface PricingComparisonSectionProps {
id?: string
heading: ReactNode
subheading?: ReactNode
plans: PricingComparisonPlan[]
rows: PricingComparisonRow[]
cta?: {
label: string
url: string
}
className?: string
}
const PlanValue = ({ value }: { value: ReactNode | boolean }) => {
if (value === true) {
return
}
if (value === false) {
return (
)
}
return {value}
}
const PricingComparisonSection: FC = ({
id,
heading,
subheading,
plans,
rows,
cta,
className,
}) => {
return (
{heading}
{subheading &&
{subheading}
}
|
What you get
|
{plans.map((plan) => (
{plan.name}
|
))}
{rows.map((row, rowIndex) => (
|
{row.feature}
|
{row.values.map((value, valueIndex) => (
|
))}
))}
{cta && }
)
}
export default PricingComparisonSection