Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat(web): redesign ProCard pricing layout
Richie McIlroye8ec4ce7fcef
diff --git a/apps/web/components/pages/HomePage/Pricing/ProCard.tsx b/apps/web/components/pages/HomePage/Pricing/ProCard.tsxindex 82a22014d..dac62cda2 100644--- a/apps/web/components/pages/HomePage/Pricing/ProCard.tsx+++ b/apps/web/components/pages/HomePage/Pricing/ProCard.tsx@@ -1,41 +1,28 @@-import { Button, Switch } from "@cap/ui";-import {- faCloud,- faCreditCard,- faLink,- faMagic,- faMinus,- faPlus,- faUsers,-} from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+"use client";++import { Button } from "@cap/ui";import NumberFlow from "@number-flow/react";import { useMutation } from "@tanstack/react-query";-import clsx from "clsx";import { useRef, useState } from "react";import { toast } from "sonner";import { useStripeContext } from "@/app/Layout/StripeContext";import { homepageCopy } from "../../../../data/homepage-copy";+import { BillingToggle } from "./BillingToggle";+import { PlanFeature } from "./PlanFeature";import { ProArt, type ProArtRef } from "./ProArt";+import { Stepper } from "./Stepper";++const copy = homepageCopy.pricing.pro;export const ProCard = () => {const stripeCtx = useStripeContext();const [users, setUsers] = useState(1);const [isAnnually, setIsAnnually] = useState(false);- const proArtRef = useRef<ProArtRef>(null);+ const artRef = useRef<ProArtRef>(null);- const CAP_PRO_ANNUAL_PRICE_PER_USER = homepageCopy.pricing.pro.pricing.annual;- const CAP_PRO_MONTHLY_PRICE_PER_USER =- homepageCopy.pricing.pro.pricing.monthly;-- const currentTotalPricePro =- users *- (isAnnually- ? CAP_PRO_ANNUAL_PRICE_PER_USER- : CAP_PRO_MONTHLY_PRICE_PER_USER);- const billingCycleTextPro = isAnnually- ? "per user, billed annually"- : "per user, billed monthly";+ const perUser = isAnnually ? copy.pricing.annual : copy.pricing.monthly;+ const monthlyTotal = perUser * users;+ const yearlyTotal = Math.round(copy.pricing.annual * 12) * users;const incrementUsers = () => setUsers((prev) => prev + 1);const decrementUsers = () => setUsers((prev) => (prev > 1 ? prev - 1 : 1));@@ -90,230 +77,85 @@ export const ProCard = () => {},});+ const isLoading = planCheckout.isPending || guestCheckout.isPending;+return (- <div- onMouseEnter={() => {- proArtRef.current?.playHoverAnimation();- }}- onMouseLeave={() => {- proArtRef.current?.playDefaultAnimation();- }}- className="flex relative flex-col flex-1 justify-between p-8 text-white rounded-2xl shadow-lg bg-gray-12"+ <article+ onMouseEnter={() => artRef.current?.playHoverAnimation()}+ onMouseLeave={() => artRef.current?.playDefaultAnimation()}+ className="flex relative flex-col p-8 rounded-2xl ring-2 shadow-xl bg-gray-1 ring-blue-500 shadow-blue-500/10">- <div>- <div className="absolute top-0 left-1/2 transform -translate-x-1/2 -translate-y-1/2">- <span className="rounded-full font-mono bg-blue-500 px-4 py-1.5 text-xs uppercase text-gray-1">- {homepageCopy.pricing.pro.badge}- </span>- </div>- <div className="md:h-[180px]">- <ProArt ref={proArtRef} />- <h3 className="mb-2 text-xl font-semibold text-center">- {homepageCopy.pricing.pro.title}- </h3>- <p className="mb-4 text-base text-center text-gray-6">- {homepageCopy.pricing.pro.description}- </p>- </div>+ <span className="absolute -top-3 left-1/2 px-3 py-1 text-xs font-semibold text-white whitespace-nowrap bg-blue-500 rounded-full -translate-x-1/2">+ Most popular+ </span>- <div className="mb-6 text-center">- <span className="mr-2 text-3xl tabular-nums text-gray-1">- $<NumberFlow suffix="/mo" value={currentTotalPricePro} />- </span>- <span className="text-base tabular-nums text-gray-8">- {" "}- {billingCycleTextPro}- </span>- {isAnnually ? (- <p className="text-base text-gray-8">- or,{" "}- <NumberFlow- value={CAP_PRO_MONTHLY_PRICE_PER_USER * users}- className="text-base tabular-nums"- format={{- notation: "compact",- style: "currency",- currency: "USD",- }}- suffix="/mo"- />{" "}- {users === 1 ? (- "per user, "- ) : (- <>- for{" "}- <NumberFlow- value={users}- className="text-base tabular-nums"- />{" "}- users,{" "}- </>- )}- billed monthly- </p>- ) : (- <p className="text-base text-gray-8">- or,{" "}- <NumberFlow- value={CAP_PRO_ANNUAL_PRICE_PER_USER * users}- className="text-base tabular-nums"- format={{- notation: "compact",- style: "currency",- currency: "USD",- }}- suffix="/mo"- />{" "}- {users === 1 ? (- "per user, "- ) : (- <>- for{" "}- <NumberFlow- value={users}- className="text-base tabular-nums"- />{" "}- users,{" "}- </>- )}- billed annually- </p>- )}- </div>-- <div className="flex flex-wrap gap-5 justify-center items-center p-5 my-8 w-full rounded-xl border xs:gap-3 xs:p-3 xs:rounded-full xs:justify-between bg-zinc-700/50 border-zinc-700">- <div className="flex gap-2 justify-center items-center">- <p className="text-sm text-gray-1">- {homepageCopy.pricing.pro.labels.users}- </p>- <div className="flex items-center">- <Button- onClick={decrementUsers}- className="p-1 bg-gray-1 hover:bg-gray-3 min-w-fit h-fit"- aria-label="Decrease user count"- >- <FontAwesomeIcon- icon={faMinus}- className="text-gray-12 size-2"- />- </Button>- <span className="w-5 font-medium tabular-nums text-center text-white">- <NumberFlow value={users} />- </span>- <Button- onClick={incrementUsers}- className="p-1 bg-gray-1 hover:bg-gray-3 min-w-fit h-fit"- aria-label="Increase user count"- >- <FontAwesomeIcon- icon={faPlus}- className="text-gray-12 size-2"- />- </Button>- </div>- </div>-- <div className="flex justify-center items-center">- <div className="flex gap-0 items-center">- <span- className={clsx(- "text-sm",- !isAnnually ? "text-white" : "text-gray-8",- )}- >- {homepageCopy.pricing.pro.labels.monthly}- </span>- <Switch- checked={isAnnually}- onCheckedChange={setIsAnnually}- aria-label="Billing Cycle For Pro"- className="scale-75"- id="billing-cycle-cap-pro"- />- <span- className={clsx(- "text-sm",- isAnnually ? "text-white" : "text-gray-8",- )}- >- {homepageCopy.pricing.pro.labels.annually}- </span>- </div>- </div>- </div>+ <div className="mb-4 size-14 -ml-3">+ <ProArt ref={artRef} /></div>-- <div className="mb-6">- <ul className="space-y-3">- <li className="flex items-center text-sm text-gray-1">- <FontAwesomeIcon- icon={faCreditCard}- className="flex-shrink-0 mr-3 text-gray-4"- style={{ fontSize: "14px", minWidth: "14px" }}- />- <span className="text-gray-4">Everything from Desktop License</span>- </li>- <li className="flex items-center text-sm text-gray-1">- <FontAwesomeIcon- icon={faCloud}- className="flex-shrink-0 mr-3 text-gray-4"- style={{ fontSize: "14px", minWidth: "14px" }}- />- <span className="text-gray-4">- Unlimited cloud storage & unlimited shareable links- </span>- </li>- <li className="flex items-center text-sm text-gray-1">- <FontAwesomeIcon- icon={faMagic}- className="flex-shrink-0 mr-3 text-gray-4"- style={{ fontSize: "14px", minWidth: "14px" }}- />- <span className="text-gray-4">- Automatic AI title, transcription, summary, and chapters- </span>- </li>- <li className="flex items-center text-sm">- <FontAwesomeIcon- icon={faLink}- className="flex-shrink-0 mr-3 text-gray-4"- style={{ fontSize: "14px", minWidth: "14px" }}- />- <span className="text-gray-4">- Connect a custom domain, e.g. cap.yourdomain.com- </span>- </li>- <li className="flex items-center text-sm text-gray-1">- <FontAwesomeIcon- icon={faUsers}- className="flex-shrink-0 mr-3 text-gray-4"- style={{ fontSize: "14px", minWidth: "14px" }}- />- <span className="text-gray-4">Shared team spaces</span>- </li>- <li className="flex items-center text-sm text-gray-1">- <FontAwesomeIcon- icon={faCloud}- className="flex-shrink-0 mr-3 text-gray-4"- style={{ fontSize: "14px", minWidth: "14px" }}- />- <span className="text-gray-4">Loom video importer</span>- </li>- </ul>+ <h3 className="text-lg font-semibold text-gray-12">{copy.title}</h3>+ <p className="mt-1.5 text-sm leading-relaxed text-gray-10 min-h-[40px]">+ Everything in Desktop, plus unlimited cloud sharing, AI, and team+ collaboration.+ </p>++ <div className="flex gap-1.5 items-baseline mt-6">+ <span className="text-4xl font-semibold tracking-tight tabular-nums text-gray-12">+ $<NumberFlow value={perUser} />+ </span>+ <span className="text-sm text-gray-10">/ user / month</span>+ </div>+ <p className="mt-1 text-sm text-gray-10">+ billed {isAnnually ? "annually" : "monthly"}+ </p>++ <div className="mt-6 space-y-3 min-h-[120px]">+ <BillingToggle+ ariaLabel="Billing cycle for Cap Pro"+ value={isAnnually ? "annual" : "monthly"}+ onChange={(value) => setIsAnnually(value === "annual")}+ options={[+ { value: "monthly", label: "Monthly" },+ { value: "annual", label: "Annual", badge: "Save 32%" },+ ]}+ />+ <Stepper+ label="Users"+ value={users}+ onIncrement={incrementUsers}+ onDecrement={decrementUsers}+ decrementLabel="Decrease user count"+ incrementLabel="Increase user count"+ />+ <p className="text-sm text-gray-10">+ Total:{" "}+ <span className="font-medium text-gray-12">+ $<NumberFlow value={isAnnually ? yearlyTotal : monthlyTotal} />+ </span>{" "}+ {isAnnually ? "/ year" : "/ month"}+ </p></div><Buttonvariant="blue"size="lg"onClick={() => planCheckout.mutate()}- disabled={planCheckout.isPending || guestCheckout.isPending}- className="w-full font-medium"+ disabled={isLoading}+ className="mt-6 w-full font-medium"aria-label="Purchase Cap Pro License">- {planCheckout.isPending || guestCheckout.isPending- ? "Loading..."- : homepageCopy.pricing.pro.cta}+ {isLoading ? "Loading..." : copy.cta}</Button>- </div>++ <div className="pt-8 mt-8 border-t border-gray-4">+ <p className="mb-4 text-sm font-medium text-gray-12">+ Everything in Desktop License, plus:+ </p>+ <ul className="space-y-3">+ {copy.features.slice(1).map((feature) => (+ <PlanFeature key={feature}>{feature}</PlanFeature>+ ))}+ </ul>+ </div>+ </article>);};