Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

feat: add toggle for annual pricing

Marc Seitz9315e82bda64
diff --git a/pages/pricing.tsx b/pages/pricing.tsx
index 938aeb05..a863fe41 100644
--- a/pages/pricing.tsx
+++ b/pages/pricing.tsx
@@ -7,14 +7,16 @@ import Link from "next/link";
import GitHubIcon from "@/components/shared/icons/github";
import { usePlausible } from "next-plausible";
import { PricingComparison } from "@/components/web/pricing-component";
+import { useEffect, useState } from "react";
+import { Switch } from "@/components/ui/switch";
const frequencies: {
value: "monthly" | "annually";
label: "Monthly" | "Annually";
- priceSuffix: "/month" | "/year";
+ priceSuffix: "/month" | "/month";
}[] = [
{ value: "monthly", label: "Monthly", priceSuffix: "/month" },
- { value: "annually", label: "Annually", priceSuffix: "/year" },
+ { value: "annually", label: "Annually", priceSuffix: "/month" },
];
const tiers: {
name: string;
@@ -58,7 +60,7 @@ const tiers: {
name: "Pro",
id: "tier-pro",
href: "/login",
- price: { monthly: "€39", annually: "€390" },
+ price: { monthly: "€29", annually: "€19" },
description: "The branded experience for your documents.",
featureIntro: "Everything in Free, plus:",
features: [
@@ -79,12 +81,12 @@ const tiers: {
name: "Business",
id: "tier-business",
href: "/login",
- price: { monthly: "€79", annually: "€790" },
+ price: { monthly: "€79", annually: "€59" },
description: "A plan that scales with your rapidly growing business.",
featureIntro: "Everything in Pro, plus:",
features: [
"3 users",
- "One data room",
+ "1 dataroom",
"Custom domain",
"Unlimited documents",
"Unlimited subfolder levels",
@@ -125,7 +127,26 @@ const tiers: {
export default function PricingPage() {
const plausible = usePlausible();
- const frequency = frequencies[0];
+ const frequency = frequencies[1];
+
+ const [toggleProYear, setToggleProYear] = useState<boolean>(true);
+ const [toggleBusinessYear, setToggleBusinessYear] = useState<boolean>(true);
+ const [frequencyPro, setFrequencyPro] = useState(frequencies[0]);
+ const [frequencyBusiness, setFrequencyBusiness] = useState(frequencies[0]);
+
+ useEffect(() => {
+ if (toggleProYear) {
+ setFrequencyPro(frequencies[1]);
+ } else {
+ setFrequencyPro(frequencies[0]);
+ }
+
+ if (toggleBusinessYear) {
+ setFrequencyBusiness(frequencies[1]);
+ } else {
+ setFrequencyBusiness(frequencies[0]);
+ }
+ }, [toggleProYear, toggleBusinessYear]);
return (
<>
@@ -181,12 +202,130 @@ export default function PricingPage() {
</h3>
</div>
<div className="p-6">
- <p className="mt-4 text-sm leading-6 text-gray-600 text-balance">
- {tier.description}
- </p>
+ <div className="mt-2 min-h-20">
+ {tier.id === "tier-free" ? (
+ <div className="min-h-12">
+ <div className="flex flex-col text-sm">
+ <div className="h-6"></div>
+ <h4>No credit card required</h4>
+ </div>
+ </div>
+ ) : null}
+ {tier.id === "tier-pro" ? (
+ <div className="min-h-12">
+ <Switch
+ className="h-5 w-10 *:size-4"
+ checked={toggleProYear}
+ onCheckedChange={() =>
+ setToggleProYear(!toggleProYear)
+ }
+ />
+ <div className="flex items-center gap-x-1 text-sm mb-1">
+ <span
+ className={cn(
+ toggleProYear
+ ? "text-gray-400"
+ : "text-black",
+ )}
+ >
+ Monthly
+ </span>
+ <span>|</span>
+ <span
+ className={cn(
+ toggleProYear
+ ? "text-black"
+ : "text-gray-400",
+ )}
+ >
+ Annually
+ </span>
+ </div>
+ <div
+ className={cn(
+ "relative text-xs w-fit uppercase border border-gray-900 text-gray-900 rounded-3xl px-1.5 py-0.5",
+ !toggleProYear &&
+ "border-gray-400 text-gray-400 opacity-40",
+ )}
+ >
+ <span
+ className={cn(
+ !toggleProYear
+ ? "absolute top-1/2 h-px w-[90%] bg-gray-400"
+ : "hidden",
+ )}
+ />
+ 30% Saving
+ </div>
+ </div>
+ ) : null}
+ {tier.id === "tier-business" ? (
+ <div className="min-h-12">
+ <Switch
+ className="h-5 w-10 *:size-4"
+ checked={toggleBusinessYear}
+ onCheckedChange={() =>
+ setToggleBusinessYear(!toggleBusinessYear)
+ }
+ />
+ <div className="flex items-center gap-x-1 text-sm mb-1">
+ <span
+ className={cn(
+ toggleBusinessYear
+ ? "text-gray-400"
+ : "text-black",
+ )}
+ >
+ Monthly
+ </span>
+ <span>|</span>
+ <span
+ className={cn(
+ toggleBusinessYear
+ ? "text-black"
+ : "text-gray-400",
+ )}
+ >
+ Annually
+ </span>
+ </div>
+ <div
+ className={cn(
+ "relative text-xs w-fit uppercase border border-[#fb7a00] text-[#fb7a00] rounded-3xl px-1.5 py-0.5",
+ !toggleBusinessYear &&
+ "border-gray-400 text-gray-400 opacity-40",
+ )}
+ >
+ <span
+ className={cn(
+ !toggleBusinessYear
+ ? "absolute top-1/2 h-px w-[90%] bg-gray-400"
+ : "hidden",
+ )}
+ />
+ 25% Saving
+ </div>
+ </div>
+ ) : null}
+ {tier.id === "tier-enterprise" ? (
+ <div className="min-h-12">
+ <div className="flex flex-col text-sm">
+ <div className="h-6"></div>
+ <h4>Get in touch</h4>
+ </div>
+ </div>
+ ) : null}
+ </div>
<p className="mt-6 flex items-baseline gap-x-1">
- <span className="text-balance text-4xl font-medium text-gray-900">
- {tier.price[frequency.value]}
+ <span
+ className="text-balance text-4xl font-medium text-gray-900"
+ style={{ fontVariantNumeric: "tabular-nums" }}
+ >
+ {tier.id === "tier-pro"
+ ? tier.price[frequencyPro.value]
+ : tier.id === "tier-business"
+ ? tier.price[frequencyBusiness.value]
+ : tier.price[frequency.value]}
</span>
<span
className={cn(
@@ -194,9 +333,16 @@ export default function PricingPage() {
tier.id === "tier-enterprise" ? "hidden" : "",
)}
>
- {frequency.priceSuffix}
+ {tier.id === "tier-pro"
+ ? frequencyPro.priceSuffix
+ : tier.id === "tier-business"
+ ? frequencyBusiness.priceSuffix
+ : frequency.priceSuffix}
</span>
</p>
+ <p className="mt-6 text-sm leading-6 text-gray-600 text-balance">
+ {tier.description}
+ </p>
<ul
role="list"
className="mt-8 space-y-3 text-sm leading-6 text-gray-600"