"use client"; import { CircleCheck } from "lucide-react"; import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardFooter, CardHeader, CardTitle, } from "@/components/ui/card"; import { Separator } from "@/components/ui/separator"; import { Switch } from "@/components/ui/switch"; import { cn } from "@/lib/utils"; const formatPrice = (value: string | number) => `${(typeof value === "string" ? Number(value) : value).toLocaleString("fa-IR")} ریال`; interface PricingFeature { text: string; } interface PricingPlan { id: string; name: string; description: string; monthlyPrice: number; yearlyPrice: number; features: PricingFeature[]; button: { text: string; url: string; }; } interface Pricing2Props { heading?: string; description?: string; plans?: PricingPlan[]; className?: string; } const Pricing2 = ({ heading = "تعرفه‌ها", description = "طرح‌های مقرون‌به‌صرفه ما را ببینید", plans = [ { id: "plus", name: "پلاس", description: "برای استفاده شخصی", monthlyPrice: 190000, yearlyPrice: 179000, features: [ { text: "تا ۵ عضو تیم" }, { text: "کتابخانه کامپوننت‌های پایه" }, { text: "پشتیبانی انجمن" }, { text: "۱ گیگابایت فضای فایل معاملات" }, ], button: { text: "خرید", url: "https://ShadcnBlocks", }, }, { id: "pro", name: "حرفه‌ای", description: "برای حرفه‌ای‌ها", monthlyPrice: 490000, yearlyPrice: 359000, features: [ { text: "اعضای تیم نامحدود" }, { text: "کامپوننت‌های پیشرفته" }, { text: "پشتیبانی اولویت‌دار" }, { text: "فضای فایل نامحدود" }, ], button: { text: "خرید", url: "https://ShadcnBlocks", }, }, ], className, }: Pricing2Props) => { const [isYearly, setIsYearly] = useState(false); return (

{heading}

{description}

ماهانه setIsYearly(!isYearly)} /> سالانه
{plans.map((plan) => (

{plan.name}

{plan.description}

{formatPrice( isYearly ? plan.yearlyPrice : plan.monthlyPrice, )} {isYearly ? "در سال" : "در ماه"}
{plan.id === "pro" && (

همه‌چیز در پلاس، به‌علاوه:

)}
    {plan.features.map((feature, index) => (
  • {feature.text}
  • ))}
))}
); }; export { Pricing2 };