mirror of
https://github.com/supabase/supabase.git
synced 2026-10-08 10:55:06 +03: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 -->
116 lines
3.7 KiB
TypeScript
116 lines
3.7 KiB
TypeScript
'use client'
|
|
|
|
import type { CTA } from '~/types/common'
|
|
import { useIsLoggedIn } from 'common'
|
|
import Link from 'next/link'
|
|
import React, { Children, type ReactNode } from 'react'
|
|
import { Button, cn } from 'ui'
|
|
|
|
import SectionContainerWithCn from '../Layouts/SectionContainerWithCn'
|
|
import ProductIcon from '../ProductIcon'
|
|
import { resolveDashboardCtaHref } from '@/lib/dashboard-links'
|
|
|
|
// to do: move types to be global
|
|
// then solutions.types.ts should extend this
|
|
interface Props {
|
|
label?: ReactNode
|
|
h1: ReactNode
|
|
subheader?: ReactNode
|
|
icon?: string
|
|
title?: string
|
|
image?: React.ReactNode
|
|
footer?: React.ReactNode
|
|
footerPosition?: 'left' | 'bottom' | 'right'
|
|
ctas?: CTA[]
|
|
className?: string
|
|
sectionContainerClassName?: string
|
|
}
|
|
|
|
const ProductHeader = ({ footerPosition = 'left', ...props }: Props) => {
|
|
const isLoggedIn = useIsLoggedIn()
|
|
|
|
return (
|
|
<div
|
|
className={cn(
|
|
'w-full max-w-full relative mx-auto py-16 lg:py-24 border-b bg-alternative overflow-hidden',
|
|
props.className
|
|
)}
|
|
>
|
|
<SectionContainerWithCn
|
|
height="none"
|
|
className={cn('grid grid-cols-12', props.sectionContainerClassName)}
|
|
>
|
|
<div
|
|
className={cn(
|
|
'relative z-10 col-span-12 lg:col-span-5',
|
|
// if not image is present, center the content
|
|
!props.image &&
|
|
'lg:col-span-12 lg:mx-auto lg:max-w-2xl text-center flex flex-col items-center'
|
|
)}
|
|
>
|
|
{(props.icon || props.title) && (
|
|
<div className="mb-4 flex items-center gap-3">
|
|
{props.icon && <ProductIcon icon={props.icon} />}
|
|
{props.title && (
|
|
<span
|
|
className="text-brand-600 dark:text-primary font-mono uppercase"
|
|
key={`product-name-${props.title}`}
|
|
>
|
|
{props.title}
|
|
</span>
|
|
)}
|
|
</div>
|
|
)}
|
|
<h1 className="h1 text-3xl md:text-4xl! lg:text-4xl! 2xl:text-6xl! tracking-[-.15px] text-balance">
|
|
{props.h1}
|
|
</h1>
|
|
{props.subheader && (
|
|
<div className="">
|
|
{Children.map(props.subheader, (subheader, i) => {
|
|
return (
|
|
<p className="p lg:text-lg max-w-lg lg:max-w-none text-pretty" key={i}>
|
|
{subheader}
|
|
</p>
|
|
)
|
|
})}
|
|
</div>
|
|
)}
|
|
<div className="flex flex-row md:flex-row md:items-center gap-2 mt-4">
|
|
{props.ctas?.map((cta) => {
|
|
const href = resolveDashboardCtaHref(cta.href, isLoggedIn)
|
|
return (
|
|
<Button
|
|
key={cta.href}
|
|
size="medium"
|
|
variant={cta.type ?? 'default'}
|
|
onClick={cta.onClick}
|
|
asChild
|
|
>
|
|
<Link href={href}>{cta.label ?? 'Start for free'}</Link>
|
|
</Button>
|
|
)
|
|
})}
|
|
</div>
|
|
{props.footer && footerPosition === 'left' && (
|
|
<div className="ph-footer relative z-10 mt-4 md:mt-8 lg:mt-20 xl:mt-32 col-span-12">
|
|
{props.footer}
|
|
</div>
|
|
)}
|
|
</div>
|
|
{props.image && (
|
|
<div className="image-container relative min-h-[300px] col-span-12 mt-8 lg:col-span-7 lg:mt-0 xl:col-span-6 xl:col-start-7">
|
|
{props.image}
|
|
</div>
|
|
)}
|
|
{props.footer && footerPosition !== 'left' && (
|
|
<div className="relative z-10 mt-4 md:mt-8 lg:mt-20 xl:mt-32 col-span-12">
|
|
{props.footer}
|
|
</div>
|
|
)}
|
|
</SectionContainerWithCn>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default ProductHeader
|