Files
supabase/apps/www/components/Pricing/PricingComputeSection.tsx
Danny White ec53175b8a refactor(ui): rename text-brand to text-primary (#50564)
## What kind of change does this PR introduce?

Refactor. Follow-up to #49871.

## What is the current behavior?

Branded (green) text still uses the `text-brand` classname while the
colour comes from `--primary`.

## What is the new behavior?

**Rename-only:** `text-brand` → `text-primary` across callsites and
docs. Leftover `bg-brand` / `border-brand` alias to `brand-default`. No
intentional colour changes in this PR.

This better matches how we treat our green in other components and
props, like `variant="primary"` for green buttons.

## To test

On light mode: smoke-test that branded text still looks like #49871
(readable green, not the bright fill).

-
[Homepage](https://zone-www-dot-com-git-dnywh-depr-316-text-brand-de2380-supabase.vercel.app/):
“Scale to millions” uses `text-primary`
- [Docs
homepage](https://docs-git-dnywh-depr-316-text-brand-to-primary-supabase.vercel.app/docs):
branded links like “More on self-hosting” are still readable
- [Typography
docs](https://design-system-git-dnywh-depr-316-text-brand-to-primary-supabase.vercel.app/design-system/docs/typography):
documents `text-primary`
- [Colour
usage](https://design-system-git-dnywh-depr-316-text-brand-to-primary-supabase.vercel.app/design-system/docs/color-usage):
`text-primary` is visibly darker than `bg-brand-default` _on light mode_
- [Studio auth
providers](https://studio-staging-git-dnywh-depr-316-text-brand-to-60fa6c-supabase.vercel.app/dashboard/project/_/auth/providers):
enabled provider badge text readable; status dot stays bright green

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Style**
* Updated branded text, link hover states, icons, badges, indicators,
and highlighted content across the Design System, Docs, Studio, Learn,
UI Library, and marketing experiences to use the primary theme color.
* Updated syntax highlighting and table-of-contents styling for
consistent primary-color presentation.
  * Refined brand color fallback behavior for bright fills and borders.

* **Documentation**
* Updated color-usage and typography guidance to recommend the primary
text utility.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-22 16:19:03 +10:00

210 lines
9.0 KiB
TypeScript

'use client'
import { ChevronDownIcon } from '@heroicons/react/outline'
import Link from 'next/link'
import React, { useEffect, useRef, useState } from 'react'
import { useWindowSize } from 'react-use'
import { plans as allPlans } from 'shared-data/plans'
import { Button, cn, ToggleGroup, ToggleGroupItem } from 'ui'
import Panel from '../Panel'
import ComputePricingCalculator from './ComputePricingCalculator'
import ComputePricingTable from './ComputePricingTable'
import PricingComputeAnimation from './PricingComputeAnimation'
const plans = allPlans
.filter((plan) => plan.planId === 'pro' || plan.planId === 'team')
.map((plan) => ({
name: plan.name,
price: plan.priceMonthly as number,
}))
const PricingComputeSection = () => {
const ref = useRef<HTMLDivElement>(null)
const [showTable, setShowTable] = useState(false)
const { width } = useWindowSize()
const [height, setHeight] = useState(ref?.current?.clientHeight)
const [activePlan, setActivePlan] = useState(plans[0])
useEffect(() => {
setHeight(ref?.current?.clientHeight)
}, [width])
return (
<Panel outerClassName="w-full mx-auto max-w-6xl" innerClassName="flex flex-col">
<div className="flex flex-col xl:grid xl:grid-cols-3 xl:gap-4">
<div className="p-4 pb-0 lg:p-8 gap-4 flex flex-col">
<div className="mb-4 grid gap-1">
<h3 className="text-foreground-light text-lg">1. Choose your plan</h3>
</div>
<ToggleGroup
type="single"
value={activePlan.name}
onValueChange={(value) => {
const selectedPlan = plans.find((p) => p.name === value)
if (selectedPlan) setActivePlan(selectedPlan)
}}
className="grid grid-cols-2 gap-2 w-full bg-surface-200 rounded-md"
>
{plans.map((plan) => (
<ToggleGroupItem
key={plan.name}
value={plan.name}
className={cn(
'w-full h-6 ',
activePlan.name === plan.name
? 'bg-surface-200 text-foreground data-[state=on]:bg-surface-400 data-[state=on]:text-foreground'
: 'hover:bg-surface-200'
)}
>
{plan.name}
</ToggleGroupItem>
))}
</ToggleGroup>
<div className="grid gap-3">
<h3 className="text-foreground text-2xl font-medium">{activePlan.name}</h3>
<div className="grid gap-1">
<p className="text-foreground text-lg">
<span className="font-mono font-bold">${activePlan.price}</span>
<span className="text-foreground-light text-sm">/month </span>
</p>
</div>
<div className="grid gap-2 text-sm">
{activePlan.name === 'Pro' && (
<>
<p className="text-foreground-light font-medium">
Everything in the Free Plan, plus:
</p>
<p className="text-foreground-light">100K monthly active users</p>
<p className="text-foreground-light">8 GB disk size per project</p>
<p className="text-foreground-light">250 GB bandwidth</p>
<p className="text-foreground-light">Daily backups (7 day retention)</p>
<p className="text-foreground-light">Email support</p>
</>
)}
{activePlan.name === 'Team' && (
<>
<p className="text-foreground-light font-medium">
Everything in the Pro Plan, plus:
</p>
<p className="text-foreground-light">SOC2 & ISO 27001</p>
<p className="text-foreground-light">Project-scoped and read-only access</p>
<p className="text-foreground-light">HIPAA available as paid add-on</p>
<p className="text-foreground-light">SSO for Supabase Dashboard</p>
<p className="text-foreground-light">Priority email support & SLAs</p>
<p className="text-foreground-light">Daily backups (14 day retention)</p>
</>
)}
<p className="text-foreground-lighter text-xs mt-2">
Paid plans include $10/mo in compute credits, enough to cover one Micro instance.
</p>
</div>
</div>
</div>
<div className="relative col-span-2 h-full w-full p-4 lg:p-8">
<h3 className="text-foreground-light text-lg mb-2">
2. Configure compute for your projects
</h3>
<p className="text-foreground-lighter text-xs mb-6">
Add projects and adjust compute to estimate your monthly cost.
</p>
<ComputePricingCalculator activePlan={activePlan} />
</div>
</div>
<hr className="border-0 border-t" />
<div className="flex flex-col">
<div className="flex flex-col items-start md:flex-row gap-2 p-6 justify-between md:items-center mt-2">
<div className="grid gap-2">
<p>
<span className="border bg-alternative px-3 py-0.5 text-foreground text-sm rounded-full text-nowrap">
Starts from <span translate="no">$10</span>/month
</span>
</p>
<h3 className="text-foreground text-2xl ml-0.5 md:ml-0 mb-2 md:mb-0">
Scale compute up to
<br className="hidden sm:block" /> 64 vCPUs and 256 GB RAM
</h3>
</div>
<Button asChild size="tiny">
<Link href="https://supabase.com/docs/guides/platform/compute-add-ons">
Learn about Compute add-ons
</Link>
</Button>
</div>
<div
className="relative w-full overflow-hidden transition-all ease-[cubic-bezier(.76,0,.23,1)]! duration-300"
style={{ height: showTable ? `${height}px` : '200px' }}
>
<div
className={cn(
'absolute inset-0 top-auto w-full h-40 bg-linear-to-t from-background-surface-100 z-20 to-transparent transition-opacity pointer-events-none not-sr-only',
showTable ? 'opacity-0 delay-200' : 'opacity-100'
)}
/>
<div ref={ref}>
<ComputePricingTable />
<div className="grid lg:grid-cols-2 gap-4 md:gap-8 mt-4 md:mt-0 border-t">
<div className="max-w-4xl prose p-4 md:p-8 relative z-10">
<h4 className="text-lg">Choose the best compute size for you</h4>
<p className="text-[13px] text-foreground-lighter">
Every project on the Supabase Platform comes with its own dedicated Postgres
instance. Select the compute size that fits your needs.
</p>
<p className="text-[13px] text-foreground-lighter">
Compute instances are billed hourly and you can scale up or down at any time. Paid
Plans come with <span translate="no">$10</span>/month in compute credits to cover
one Micro instance or offset the cost of any other instance.
</p>
<p className="text-[13px] text-foreground-lighter">
Read more on{' '}
<Link
href="https://supabase.com/docs/guides/platform/manage-your-usage/compute"
target="_blank"
className="transition text-primary hover:text-brand-600"
>
usage-based billing for compute
</Link>{' '}
or{' '}
<Link
href="https://supabase.com/docs/guides/platform/compute-add-ons"
target="_blank"
className="transition text-primary hover:text-brand-600"
>
Compute Add-ons
</Link>
.
</p>
</div>
<div className="relative -mt-8 lg:mt-0 z-0">
<PricingComputeAnimation />
</div>
</div>
</div>
</div>
<button
tabIndex={0}
onClick={() => setShowTable(!showTable)}
className="group w-full p-2 border-t border-muted text-foreground outline-hidden rounded-b-xl text-sm bg-alternative flex items-center justify-center"
>
{/* Label-scoped ring: full-bleed focus-ring clips under Panel overflow-hidden */}
<span className="inline-flex items-center gap-2 rounded-md px-2 py-0.5 group-focus-visible:ring-2 group-focus-visible:ring-ring">
<ChevronDownIcon
className={cn(
'w-4 transition-transform transform origin-center',
showTable ? 'rotate-180' : 'rotate-0'
)}
/>
{!showTable ? 'Expand' : 'Hide'} Pricing breakdown
</span>
</button>
</div>
</Panel>
)
}
export default PricingComputeSection