import { FC, useState } from "react"; import { CheckCircle } from "lucide-react"; import { Tab } from "@headlessui/react"; // helpers import { cn } from "@/helpers/common.helper"; export type ProPlanUpgradeProps = { basePlan: "Free" | "One"; features: string[]; verticalFeatureList?: boolean; extraFeatures?: string | React.ReactNode; }; type TProPiceFrequency = "month" | "year"; type TProPlanPrice = { key: string; price: string; recurring: TProPiceFrequency; }; const PRO_PLAN_PRICES: TProPlanPrice[] = [ { key: "monthly", price: "$7", recurring: "month" }, { key: "yearly", price: "$5", recurring: "year" }, ]; export const ProPlanUpgrade: FC = (props) => { const { basePlan, features, verticalFeatureList = false, extraFeatures } = props; // states const [selectedPlan, setSelectedPlan] = useState("month"); // env const PRO_PLAN_MONTHLY_PAYMENT_URL = process.env.NEXT_PUBLIC_PRO_PLAN_MONTHLY_PAYMENT_URL ?? "https://plane.so/pro"; const PRO_PLAN_YEARLY_PAYMENT_URL = process.env.NEXT_PUBLIC_PRO_PLAN_YEARLY_PAYMENT_URL ?? "https://plane.so/pro"; return (
{PRO_PLAN_PRICES.map((price: TProPlanPrice) => ( cn( "w-full rounded-lg py-1.5 text-sm font-medium leading-5", selected ? "bg-custom-background-100 text-custom-primary-300 shadow" : "hover:bg-custom-primary-100/5 text-custom-text-300 hover:text-custom-text-200" ) } onClick={() => setSelectedPlan(price.recurring)} > <> {price.recurring === "month" && ("Monthly" as string)} {price.recurring === "year" && ("Yearly" as string)} {price.recurring === "year" && ( -28% )} ))}
{PRO_PLAN_PRICES.map((price: TProPlanPrice) => (
Plane Pro
{price.recurring === "month" && "$7"} {price.recurring === "year" && "$5"}
a user per month
{`Everything in ${basePlan} +`}
    {features.map((feature) => (
  • {feature}

  • ))}
{extraFeatures &&
{extraFeatures}
}
))}
); };