-
-
Notifications
You must be signed in to change notification settings - Fork 702
docs: add yearly pricing option with discount #2597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| "use client"; | ||
|
|
||
| import { cn } from "@/lib/fumadocs/cn"; | ||
| import { useState } from "react"; | ||
| import { Tier, Tiers } from "./tiers"; | ||
|
|
||
| type Frequency = "month" | "year"; | ||
|
|
||
| export function PricingTiers({ tiers }: { tiers: Tier[] }) { | ||
| const [frequency, setFrequency] = useState<Frequency>("year"); | ||
|
|
||
| return ( | ||
| <> | ||
| {/* Frequency Toggle */} | ||
| <div className="mb-10 flex items-center justify-center gap-3"> | ||
| <span | ||
| className={cn( | ||
| "text-sm font-medium transition-colors", | ||
| frequency === "month" ? "text-stone-900" : "text-stone-400", | ||
| )} | ||
| > | ||
| Monthly | ||
| </span> | ||
| <button | ||
| type="button" | ||
| role="switch" | ||
| aria-checked={frequency === "year"} | ||
| onClick={() => | ||
| setFrequency((f) => (f === "month" ? "year" : "month")) | ||
| } | ||
| className={cn( | ||
| "relative inline-flex h-7 w-12 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors", | ||
| frequency === "year" ? "bg-purple-600" : "bg-stone-300", | ||
| )} | ||
| > | ||
| <span | ||
| className={cn( | ||
| "pointer-events-none inline-block h-6 w-6 rounded-full bg-white shadow-sm ring-0 transition-transform", | ||
| frequency === "year" ? "translate-x-5" : "translate-x-0", | ||
| )} | ||
| /> | ||
| </button> | ||
| <span | ||
| className={cn( | ||
| "text-sm font-medium transition-colors", | ||
| frequency === "year" ? "text-stone-900" : "text-stone-400", | ||
| )} | ||
| > | ||
| Yearly | ||
| </span> | ||
| <span className="rounded-full bg-green-100 px-2.5 py-0.5 text-xs font-semibold text-green-700"> | ||
| Save 50% | ||
| </span> | ||
| </div> | ||
|
|
||
| <Tiers tiers={tiers} frequency={frequency} /> | ||
| </> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,14 @@ export const PRODUCTS = { | |
| name: "Business", | ||
| slug: "business", | ||
| } as const, | ||
| "business-yearly": { | ||
| id: | ||
| process.env.NODE_ENV === "production" | ||
| ? "ba3965dc-e1ca-494e-b36a-62e2e41615d4" | ||
| : "NOT-CREATED", | ||
| name: "Business Yearly", | ||
| slug: "business-yearly", | ||
| } as const, | ||
|
Comment on lines
+10
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Expected: a placeholder non-production id in product-list,
# the slug registered in auth checkout config,
# and the pricing UI defaulting to yearly.
rg -n -C2 '"business-yearly"|NOT-CREATED' docs/lib/product-list.ts docs/lib/auth.ts
rg -n -C2 'useState<Frequency>\("year"\)' docs/app/pricing/PricingTiers.tsxRepository: TypeCellOS/BlockNote Length of output: 1089 Add sandbox product ID for non-production yearly flow or gate yearly outside production. The yearly plan defaults in the UI (docs/app/pricing/PricingTiers.tsx, line 10) and is registered in checkout (docs/lib/auth.ts, lines 211–212), but uses the placeholder 🤖 Prompt for AI Agents |
||
| starter: { | ||
| id: | ||
| process.env.NODE_ENV === "production" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give the billing switch a programmatic label.
The control has
role="switch"andaria-checked, but it still has no accessible name, so screen readers will announce an unnamed switch. Addaria-labelor wirearia-labelledbyto the visible “Monthly/Yearly” text.Accessibility fix
<button type="button" role="switch" + aria-label="Toggle billing frequency" aria-checked={frequency === "year"}📝 Committable suggestion
🤖 Prompt for AI Agents