UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
fix: update pricing section
Dillion Vermae9dbc81d2bae
diff --git a/registry/blocks/example/pricing-1.tsx b/registry/blocks/example/pricing-1.tsxindex 41338371..427f5a66 100644--- a/registry/blocks/example/pricing-1.tsx+++ b/registry/blocks/example/pricing-1.tsx@@ -13,140 +13,70 @@ type Interval = "month" | "year";export const toHumanPrice = (price: number, decimals: number = 2) => {return Number(price / 100).toFixed(decimals);};--// Demo prices object to simulate dynamic pricing data with added plans-const demoPrices = {- month: [- {- id: "price_1",- product: {- name: "Basic",- description: "A basic plan for startups and individual users",- features: [- "AI-powered analytics",- "Basic support",- "5 projects limit",- "Access to basic AI tools",- ],- },- unit_amount: 1000,- },- {- id: "price_2",- product: {- name: "Premium",- description: "A premium plan for growing businesses",- features: [- "Advanced AI insights",- "Priority support",- "Unlimited projects",- "Access to all AI tools",- "Custom integrations",- ],- },- unit_amount: 2000,- },- {- id: "price_5",- product: {- name: "Enterprise",- description:- "An enterprise plan with advanced features for large organizations",- features: [- "Custom AI solutions",- "24/7 dedicated support",- "Unlimited projects",- "Access to all AI tools",- "Custom integrations",- "Data security and compliance",- ],- },- unit_amount: 5000,- },- {- id: "price_6",- product: {- name: "Ultimate",- description: "The ultimate plan with all features for industry leaders",- features: [- "Bespoke AI development",- "White-glove support",- "Unlimited projects",- "Priority access to new AI tools",- "Custom integrations",- "Highest data security and compliance",- ],- },- unit_amount: 8000,- },- ],- year: [- {- id: "price_3",- product: {- name: "Basic",- description:- "A basic plan, billed annually, for startups and individual users",- features: [- "AI-powered analytics",- "Basic support",- "5 projects limit",- "Access to basic AI tools",- ],- },- unit_amount: 10000,- },- {- id: "price_4",- product: {- name: "Premium",- description: "A premium plan, billed annually, for growing businesses",- features: [- "Advanced AI insights",- "Priority support",- "Unlimited projects",- "Access to all AI tools",- "Custom integrations",- ],- },- unit_amount: 20000,- },- {- id: "price_7",- product: {- name: "Enterprise",- description:- "An enterprise plan with advanced features, billed annually, for large organizations",- features: [- "Custom AI solutions",- "24/7 dedicated support",- "Unlimited projects",- "Access to all AI tools",- "Custom integrations",- "Data security and compliance",- ],- },- unit_amount: 50000,- },- {- id: "price_8",- product: {- name: "Ultimate",- description:- "The ultimate plan with all features, billed annually, for industry leaders",- features: [- "Bespoke AI development",- "White-glove support",- "Unlimited projects",- "Priority access to new AI tools",- "Custom integrations",- "Highest data security and compliance",- ],- },- unit_amount: 80000,- },- ],-};+const demoPrices = [+ {+ id: "price_1",+ name: "Basic",+ description: "A basic plan for startups and individual users",+ features: [+ "AI-powered analytics",+ "Basic support",+ "5 projects limit",+ "Access to basic AI tools",+ ],+ monthlyPrice: 1000,+ yearlyPrice: 10000,+ isMostPopular: false,+ },+ {+ id: "price_2",+ name: "Premium",+ description: "A premium plan for growing businesses",+ features: [+ "Advanced AI insights",+ "Priority support",+ "Unlimited projects",+ "Access to all AI tools",+ "Custom integrations",+ ],+ monthlyPrice: 2000,+ yearlyPrice: 20000,+ isMostPopular: true,+ },+ {+ id: "price_5",+ name: "Enterprise",+ description:+ "An enterprise plan with advanced features for large organizations",+ features: [+ "Custom AI solutions",+ "24/7 dedicated support",+ "Unlimited projects",+ "Access to all AI tools",+ "Custom integrations",+ "Data security and compliance",+ ],+ monthlyPrice: 5000,+ yearlyPrice: 50000,+ isMostPopular: false,+ },+ {+ id: "price_6",+ name: "Ultimate",+ description: "The ultimate plan with all features for industry leaders",+ features: [+ "Bespoke AI development",+ "White-glove support",+ "Unlimited projects",+ "Priority access to new AI tools",+ "Custom integrations",+ "Highest data security and compliance",+ ],+ monthlyPrice: 8000,+ yearlyPrice: 80000,+ isMostPopular: false,+ },+];export default function Pricing() {const [interval, setInterval] = useState<Interval>("month");@@ -160,17 +90,6 @@ export default function Pricing() {setIsLoading(false);};- const fadeUpVariants = {- initial: {- opacity: 0,- y: 24,- },- animate: {- opacity: 1,- y: 0,- },- };-return (<section id="pricing"><div className="mx-auto flex max-w-screen-xl flex-col gap-8 px-4 py-14 md:px-8">@@ -208,82 +127,94 @@ export default function Pricing() {</div><div className="mx-auto grid w-full justify-center gap-8 sm:grid-cols-2 lg:grid-cols-4">- {demoPrices[interval].map((price, idx) => (- <motion.div+ {demoPrices.map((price, idx) => (+ <divkey={price.id}- initial="initial"- animate="animate"- variants={fadeUpVariants}- transition={{- duration: 0.6,- delay: 0.1 + idx * 0.05,- ease: [0.21, 0.47, 0.32, 0.98],- }}- className={cn("relative h-full max-w-[400px]")}+ className={cn(+ " relative flex h-full max-w-[400px] flex-col gap-8 overflow-hidden rounded-2xl border p-4 text-black dark:text-white",+ {+ "border-4 border-neutral-700 shadow-lg shadow-neutral-500 dark:border-neutral-400 dark:shadow-neutral-600":+ price.isMostPopular,+ },+ )}>- <div- className={cn(- "relative flex h-full flex-col gap-8 overflow-hidden rounded-2xl border p-4 text-black dark:text-white",- )}- >- <div className="z-10 flex h-full w-full flex-col gap-4">- <div className="flex items-center">- <div className="ml-4">- <h2 className="text-base font-semibold leading-7">- {price.product.name}- </h2>- <p className="h-16 text-sm leading-5 text-black/70 dark:text-white">- {price.product.description}- </p>- </div>+ <div className="z-10 flex h-full w-full flex-col gap-4">+ <div className="flex items-center">+ <div className="ml-4">+ <h2 className="text-base font-semibold leading-7">+ {price.name}+ </h2>+ <p className="h-16 text-sm leading-5 text-black/70 dark:text-white">+ {price.description}+ </p></div>+ </div>- <div className="flex flex-row gap-1">- <span className="text-4xl font-bold text-black dark:text-white">- ${toHumanPrice(price.unit_amount ?? 0, 0)}- <span className="text-xs"> / {interval}</span>- </span>- </div>+ <motion.div+ key={`${price.id}-${interval}`}+ initial="initial"+ animate="animate"+ variants={{+ initial: {+ opacity: 0,+ y: 12,+ },+ animate: {+ opacity: 1,+ y: 0,+ },+ }}+ transition={{+ duration: 0.4,+ delay: 0.1 + idx * 0.05,+ ease: [0.21, 0.47, 0.32, 0.98],+ }}+ className="flex flex-row gap-1"+ >+ <span className="text-4xl font-bold text-black dark:text-white">+ $+ {interval === "year"+ ? toHumanPrice(price.yearlyPrice, 0)+ : toHumanPrice(price.monthlyPrice, 0)}+ <span className="text-xs"> / {interval}</span>+ </span>+ </motion.div>- <Button- className={cn(- "group relative w-full gap-2 overflow-hidden text-lg font-semibold tracking-tighter",- "transform-gpu ring-offset-current transition-all duration-300 ease-out hover:ring-2 hover:ring-primary hover:ring-offset-2",- )}- disabled={isLoading}- onClick={() => void onSubscribeClick(price.id)}- >- <span className="absolute right-0 -mt-12 h-32 w-8 translate-x-12 rotate-12 transform-gpu bg-white opacity-10 transition-all duration-1000 ease-out group-hover:-translate-x-96 dark:bg-black" />- {(!isLoading || (isLoading && id !== price.id)) && (- <p>Subscribe</p>- )}+ <Button+ className={cn(+ "group relative w-full gap-2 overflow-hidden text-lg font-semibold tracking-tighter",+ "transform-gpu ring-offset-current transition-all duration-300 ease-out hover:ring-2 hover:ring-primary hover:ring-offset-2",+ )}+ disabled={isLoading}+ onClick={() => void onSubscribeClick(price.id)}+ >+ <span className="absolute right-0 -mt-12 h-32 w-8 translate-x-12 rotate-12 transform-gpu bg-white opacity-10 transition-all duration-1000 ease-out group-hover:-translate-x-96 dark:bg-black" />+ {(!isLoading || (isLoading && id !== price.id)) && (+ <p>Subscribe</p>+ )}- {isLoading && id === price.id && <p>Subscribing</p>}- {isLoading && id === price.id && (- <Loader className="mr-2 h-4 w-4 animate-spin" />- )}- </Button>+ {isLoading && id === price.id && <p>Subscribing</p>}+ {isLoading && id === price.id && (+ <Loader className="mr-2 h-4 w-4 animate-spin" />+ )}+ </Button>- <hr className="m-0 h-px w-full border-none bg-gradient-to-r from-neutral-200/0 via-neutral-500/30 to-neutral-200/0" />- {price.product.features &&- price.product.features.length > 0 && (- <ul className="flex flex-col gap-2 font-normal">- {price.product.features.map(- (feature: any, idx: any) => (- <li- key={idx}- className="flex items-center gap-3 text-xs font-medium text-black dark:text-white"- >- <CheckIcon className="h-5 w-5 shrink-0 rounded-full bg-green-400 p-[2px] text-black dark:text-white" />- <span className="flex">{feature}</span>- </li>- ),- )}- </ul>- )}- </div>+ <hr className="m-0 h-px w-full border-none bg-gradient-to-r from-neutral-200/0 via-neutral-500/30 to-neutral-200/0" />+ {price.features && price.features.length > 0 && (+ <ul className="flex flex-col gap-2 font-normal">+ {price.features.map((feature: any, idx: any) => (+ <li+ key={idx}+ className="flex items-center gap-3 text-xs font-medium text-black dark:text-white"+ >+ <CheckIcon className="h-5 w-5 shrink-0 rounded-full bg-green-400 p-[2px] text-black dark:text-white" />+ <span className="flex">{feature}</span>+ </li>+ ))}+ </ul>+ )}</div>- </motion.div>+ </div>))}</div></div>