mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
## 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 -->
84 lines
2.7 KiB
TypeScript
84 lines
2.7 KiB
TypeScript
'use client'
|
|
|
|
import Link from 'next/link'
|
|
import { useMemo } from 'react'
|
|
|
|
import './surveyResults.css'
|
|
|
|
interface Participant {
|
|
company: string
|
|
url: string
|
|
}
|
|
|
|
const ROW_COUNT = 5
|
|
const ROW_DURATIONS_SECONDS = [320, 380, 280, 440, 340]
|
|
|
|
function chunkIntoRows<T>(items: T[], rowCount: number): T[][] {
|
|
const rows: T[][] = Array.from({ length: rowCount }, () => [])
|
|
items.forEach((item, index) => {
|
|
rows[index % rowCount].push(item)
|
|
})
|
|
return rows
|
|
}
|
|
|
|
function shuffleSeeded<T>(items: T[], seed: number): T[] {
|
|
// Deterministic shuffle so SSR and client agree.
|
|
const copy = [...items]
|
|
let state = seed
|
|
for (let i = copy.length - 1; i > 0; i--) {
|
|
state = (state * 9301 + 49297) % 233280
|
|
const j = Math.floor((state / 233280) * (i + 1))
|
|
;[copy[i], copy[j]] = [copy[j], copy[i]]
|
|
}
|
|
return copy
|
|
}
|
|
|
|
export function ParticipantsCarousel({ participants }: { participants: Participant[] }) {
|
|
const rows = useMemo(() => {
|
|
const shuffled = shuffleSeeded(participants, 1)
|
|
return chunkIntoRows(shuffled, ROW_COUNT)
|
|
}, [participants])
|
|
|
|
return (
|
|
<div className="w-full flex flex-col gap-4 md:gap-6">
|
|
{rows.map((row, rowIndex) => {
|
|
if (row.length === 0) return null
|
|
const duration = ROW_DURATIONS_SECONDS[rowIndex % ROW_DURATIONS_SECONDS.length]
|
|
const reverse = rowIndex % 2 === 1
|
|
// Duplicate so the loop is seamless: translateX(-50%) lands the start of
|
|
// the second copy exactly where the first started.
|
|
const loop = [...row, ...row]
|
|
return (
|
|
<div
|
|
key={rowIndex}
|
|
className="marquee-row group relative w-full overflow-hidden"
|
|
style={{
|
|
maskImage: 'linear-gradient(to right, transparent, black 4%, black 96%, transparent)',
|
|
WebkitMaskImage:
|
|
'linear-gradient(to right, transparent, black 4%, black 96%, transparent)',
|
|
}}
|
|
>
|
|
<ul
|
|
className={`marquee-track${reverse ? ' marquee-track--reverse' : ''} flex w-max items-center gap-5 md:gap-7`}
|
|
style={{ animationDuration: `${duration}s` }}
|
|
>
|
|
{loop.map((participant, index) => (
|
|
<li key={`${rowIndex}-${index}-${participant.company}`} className="shrink-0">
|
|
<Link
|
|
href={participant.url}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
className="text-xs md:text-sm font-mono tracking-widest uppercase text-foreground-lighter hover:text-primary transition-colors whitespace-nowrap"
|
|
>
|
|
{participant.company}
|
|
</Link>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</div>
|
|
)
|
|
})}
|
|
</div>
|
|
)
|
|
}
|