import { For } from "solid-js"
import type { PlanId } from "@/lib/api"
import { plans } from "@/lib/state"
function CheckIcon() {
return (
)
}
function XIcon() {
return (
)
}
function priceLabel(amount: number) {
if (amount === 0) return "Free"
return `$${amount / 100}`
}
function memberLabel(members: number | null) {
if (members === null) return "Unlimited members"
return `Up to ${members} members`
}
type PricingTableProps = {
selectable?: boolean
selectedPlan?: PlanId
onSelect?: (plan: PlanId) => void
onCta?: (plan: PlanId) => void
}
export default function PricingTable(props: PricingTableProps) {
return (
{(plan) => {
const isPopular = plan.id === "basic"
const isSelected = () => props.selectable && props.selectedPlan === plan.id
const card = (
<>
{isPopular && !props.selectable && (
POPULAR
)}
{plan.name}
/ mo
- {memberLabel(plan.members)}
-
{plan.blossom ? : }
Blossom storage
-
{plan.livekit ? : }
LiveKit video
{!props.selectable && (
)}
>
)
if (props.selectable) {
return (
)
}
return (
{card}
)
}}
)
}