Files
supabase/apps/www/components/SurveyResults/StateOfStartupsHeader.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

137 lines
3.6 KiB
TypeScript

import { useMemo } from 'react'
import { ProgressBar } from './DecorativeProgressBar'
interface StateOfStartupsHeaderProps {
showProgressBars?: boolean
}
const DiagonalStripes = () => (
<div
className="grow"
style={{
backgroundImage: `repeating-linear-gradient(
45deg,
var(--border-muted) 0px,
var(--border-muted) 1px,
transparent 1px,
transparent 8px
)`,
}}
/>
)
const HeaderProgressBar = ({
delay = 0,
progressBgColor = 'bg-foreground-muted/80',
progressFgColor,
}: {
delay?: number
progressBgColor?: string
progressFgColor?: string
}) => (
<div className="grow">
<ProgressBar
className="h-full"
backgroundClassName={progressBgColor}
foregroundClassName={progressFgColor}
animationDelay={`${delay}s`}
/>
</div>
)
interface TextBlockProps {
text: string
bgColor: string
textColor: string
showProgressBar?: boolean
}
const TextBlock = ({
text,
bgColor,
textColor,
showProgressBar = true,
delay = 0,
progressBgColor,
progressFgColor,
}: TextBlockProps & { delay?: number; progressBgColor?: string; progressFgColor?: string }) => (
<div className="flex w-full items-stretch">
<div className={`inline-block ${bgColor}`}>
<span
className={`${textColor} text-[2rem] md:text-[4rem] px-2.5 md:px-8 py-1.5 md:py-3 inline-block leading-none tracking-tight`}
>
{text}
</span>
</div>
{showProgressBar ? (
<HeaderProgressBar
delay={delay}
progressBgColor={progressBgColor}
progressFgColor={progressFgColor}
/>
) : (
<DiagonalStripes />
)}
</div>
)
export function StateOfStartupsHeader({ showProgressBars = true }: StateOfStartupsHeaderProps) {
// Generate stable random delays between 0.2 and 2 seconds for each TextBlock
const randomDelays = useMemo(
() => [
0.2 + Math.random() * 1.8,
0.2 + Math.random() * 1.8,
0.2 + Math.random() * 1.8,
0.2 + Math.random() * 1.8,
],
[]
)
return (
<header className="mt-16 md:mt-32">
<div className="max-w-240 ml-8 md:mx-auto">
<div className="flex flex-col gap-0.5 md:gap-1">
<h1 className="sr-only">State of Startups 2025</h1>
<TextBlock
text="State"
bgColor="bg-brand-300"
textColor="text-primary"
showProgressBar={showProgressBars}
delay={randomDelays[0]}
progressBgColor="bg-surface-400 dark:bg-surface-300"
progressFgColor="bg-brand-300"
/>
<TextBlock
text="of"
bgColor="bg-brand-300"
textColor="text-primary"
showProgressBar={showProgressBars}
delay={randomDelays[1]}
progressBgColor="bg-surface-400 dark:bg-surface-300"
progressFgColor="bg-brand-300"
/>
<TextBlock
text="Startups"
bgColor="bg-brand-default"
textColor="text-background dark:text-brand-200"
showProgressBar={showProgressBars}
delay={randomDelays[2]}
progressBgColor="bg-surface-400 dark:bg-surface-300"
progressFgColor="bg-brand-default dark:bg-brand-default"
/>
<TextBlock
text="2025"
bgColor="bg-brand-500"
textColor="text-brand-300"
showProgressBar={showProgressBars}
delay={randomDelays[3]}
progressBgColor="bg-surface-400 dark:bg-surface-300"
progressFgColor="bg-brand-500"
/>
</div>
</div>
</header>
)
}