import { CircleCheckFilled, CrossfadeIcon } from '~/components/CrossfadeIcon' import { BRAND_ASSETS, type BrandAsset } from '~/data/brand-assets' import { Code, Copy, Download } from 'lucide-react' import { motion, MotionConfig } from 'motion/react' import Image from 'next/image' import { useState, type ReactNode } from 'react' import { cn, copyToClipboard, Tabs, TabsContent, TabsIndicator, TabsList, TabsTrigger } from 'ui' import { CodeBlockControls } from 'ui-patterns/CodeBlock/CodeBlockControls' import { CodeBlockFrame, CodeBlockTokens, type CodeToken, } from 'ui-patterns/CodeBlock/CodeBlockFrame' import { getNotchStyle } from 'ui-patterns/Notch' import { NotchOutline } from 'ui-patterns/Notch/NotchOutline' type Canvas = 'light' | 'dark' export interface LogoGalleryProps { className?: string } interface AssetSectionProps { id?: string title: string description: ReactNode children: ReactNode } interface BrandColor { name: string token: string value: string hex: string rgb: string hsl: string oklch: string } interface PaneDownload { href: string label: string } interface PaneSnippet { src: string alt: string width: number height: number } interface PaneProps { caption: string snippet: PaneSnippet assetName: string getCopyText: () => string | Promise downloads: PaneDownload[] children: ReactNode className?: string } const NOTCH_WIDTH = 80 const ROW_HIGHLIGHT_TRANSITION = { type: 'tween', duration: 0.15, ease: [0.4, 0, 0.2, 1] } as const const MORPH_TRANSITION = { type: 'spring', duration: 0.4, bounce: 0 } as const const SNIPPET_HEIGHT = 24 // the snippets are known shapes, so they carry their docs token classes instead of loading shiki const SNIPPET_FORMATS: { value: string label: string language: string toLines: (snippet: PaneSnippet) => CodeToken[][] }[] = [ { value: 'html', label: 'HTML', language: 'html', toLines: ({ src, alt, width, height }) => [ [ ['<', 's-p'], ['img', 's-k'], ], ...Object.entries({ src, alt, width, height }).map(([name, value]): CodeToken[] => [ [' ', undefined], [name, 's-r'], ['=', 's-p'], [`"${value}"`, 's-s'], ]), [['/>', 's-p']], ], }, { value: 'markdown', label: 'Markdown', language: 'markdown', toLines: ({ src, alt }) => [ [ ['![', 's-p'], [alt, 's-s'], ['](', 's-p'], [src, 's-u'], [')', 's-p'], ], ], }, ] const GROUPS: { id: BrandAsset['group'] title: string description: string imageClassName: string }[] = [ { id: 'icon', title: 'Icon', description: 'The green symbol without lettering. Use it in small spaces, such as avatars, app icons, or a row of partner logos.', imageClassName: 'h-24 w-auto', }, { id: 'logo', title: 'Wordmark', description: 'The symbol and the Supabase lettering together. Use it by default when there is space for the name.', imageClassName: 'h-12 w-auto', }, { id: 'one-color', title: 'One-color wordmark', description: 'The wordmark in black or white. Use it when you can print only one color, or on top of a photo.', imageClassName: 'h-12 w-auto', }, ] const CANVAS_CAPTIONS: Record = { light: 'Light', dark: 'Dark', } // the green is the color in the logo files. the grays come from the design system tokens in packages/ui/build/css const COLORS: BrandColor[] = [ { name: 'Supabase green', token: 'brand-default', value: 'hsl(var(--brand-default))', hex: '#3ECF8E', rgb: 'rgb(62 207 142)', hsl: 'hsl(153.1 60.2% 52.7%)', oklch: 'oklch(76.2% 0.154 159.4)', }, { name: 'Dark gray', token: 'gray-dark-200', value: 'hsl(var(--colors-gray-dark-200))', hex: '#1C1C1C', rgb: 'rgb(28 28 28)', hsl: 'hsl(0 0% 11%)', oklch: 'oklch(22.6% 0 0)', }, { name: 'Light gray', token: 'gray-light-200', value: 'hsl(var(--colors-gray-light-200))', hex: '#F8F8F8', rgb: 'rgb(248 248 248)', hsl: 'hsl(0 0% 97.3%)', oklch: 'oklch(97.9% 0 0)', }, ] const CONNECT_BUTTON_URL = 'https://obuldanrptloktxcffvn.supabase.co/storage/v1/object/public/supabase-brand-assets/connect-supabase' const CONNECT_BUTTONS: { canvas: Canvas; svg: string; alt: string }[] = [ { canvas: 'light', svg: `${CONNECT_BUTTON_URL}/connect-supabase-dark.svg`, alt: 'Dark Connect Supabase button', }, { canvas: 'dark', svg: `${CONNECT_BUTTON_URL}/connect-supabase-light.svg`, alt: 'Light Connect Supabase button', }, ] // a failed fetch rejects, so copyToClipboard shows its error toast instead of copying the error page const fetchText = (url: string) => fetch(url).then((response) => { if (!response.ok) throw new Error(`${response.status} ${url}`) return response.text() }) export const LogoGallery = ({ className }: LogoGalleryProps) => (
{GROUPS.map((group) => { const assets = BRAND_ASSETS.filter((asset) => asset.group === group.id) const panes = assets.flatMap((asset) => asset.canvas === 'any' ? (['light', 'dark'] satisfies Canvas[]).map((canvas) => ({ canvas, asset })) : [{ canvas: asset.canvas, asset }] ) return ( {panes.map(({ canvas, asset }) => ( fetchText(asset.svg)} downloads={[ { href: asset.svg, label: '.svg' }, { href: asset.png, label: '.png' }, ]} className={cn( 'items-center justify-center p-10', canvas === 'dark' ? 'bg-pane-dark' : 'bg-white' )} > { ))} ) })} Use the Connect Supabase button to start the OAuth 2.0 flow in your{' '} Supabase integration . Do not use the button as a logo. } > {CONNECT_BUTTONS.map((button) => ( fetchText(button.svg)} downloads={[ { href: button.svg, label: '.svg' }, { href: `${CONNECT_BUTTON_URL}/connect-supabase.zip`, label: '.zip' }, ]} className={cn( 'items-center justify-center p-10', button.canvas === 'dark' ? 'bg-pane-dark' : 'bg-white' )} > {button.alt} ))}
) const AssetSection = ({ id, title, description, children }: AssetSectionProps) => (

{title}

{description}

{children}
) const Pane = ({ caption, snippet, assetName, getCopyText, downloads, children, className, }: PaneProps) => { const [isCopied, setIsCopied] = useState(false) const [isCodeOpen, setIsCodeOpen] = useState(false) const handleCodeClick = () => setIsCodeOpen((isOpen) => !isOpen) // the ClipboardItem promise keeps a fetched copy inside the user gesture in safari. // the canvas copies on click, and the copy button below is the keyboard path to the same action const handleCopy = () => { copyToClipboard(Promise.resolve(getCopyText()), () => { setIsCopied(true) setTimeout(() => setIsCopied(false), 2000) }) } return (
{isCodeOpen ? null : (
{caption}
{downloads.map((download) => ( Download {assetName} as {download.label} ))}
) } const ColorPalette = ({ colors }: { colors: BrandColor[] }) => { const [copied, setCopied] = useState(null) const [hoveredRow, setHoveredRow] = useState(null) // react batches the leave and the next enter, so the highlight still slides between rows const handleRowLeave = () => setHoveredRow(null) const handleCopy = (key: string, value: string) => { copyToClipboard(value, () => { setCopied(key) setTimeout(() => setCopied(null), 2000) }) } return (
{colors.map((color) => (

{color.name}

{color.token}

div:hover]:before:opacity-0 [&>div:has(+div:hover)]:before:opacity-0' )} > {hoveredRow?.startsWith(`${color.token}:`) ? null : ( )} {[ { label: 'HEX', value: color.hex }, { label: 'RGB', value: color.rgb }, { label: 'HSL', value: color.hsl }, { label: 'OKLCH', value: color.oklch }, ].map((format) => { const key = `${color.token}:${format.label}` const isCopied = copied === key return (
setHoveredRow(key)} onPointerLeave={handleRowLeave} className={cn( 'group/row relative isolate flex items-center gap-3 px-3 py-1.5', 'before:absolute before:inset-x-3 before:bottom-0 before:h-px before:transition-opacity', 'not-last:before:bg-border' )} > {hoveredRow === key ? ( ) : null}
{format.label}
{format.value}
) })}
))}
) }