feat(www): brand page (#52295)
## Problem - a person or an agent cannot link one logo file or pick the file for a light or a dark background as the brand assets page has one preview image and two zip downloads only - `apps/www/lib/json-ld.ts` sets `Organization.logo` to the open graph banner instead of a logo file ## Solution - [proposal] Brand Assets -> Brand Guidelines - [proposal] `/brand-assets` -> `/brand` - adds the official logos as separate svg and png files in `/brand-assets/`, with a catalog that tells the background that each file is for - show each file on its background, with copy and download actions - adds `/brand.md` and a "Copy agent prompt" button, so an agent can read which file to use for each background - adds a "Copy wordmark" item to the nav logo menu, which copies the wordmark file for the site theme - changes `Organization.logo` from the open graph banner to the wordmark png `brand assets page` | before | after | | -------|------| | <img width="1637" height="901" alt="image" src="https://github.com/user-attachments/assets/6b5361c8-0995-4e61-bc29-b5a7ccab7d69" /> | <img width="1637" height="901" alt="image" src="https://github.com/user-attachments/assets/0f65ab36-d6f2-427e-8973-eb559139cf8e" /> | `logo right click` | before | after | | -------|------| | <img width="676" height="362" alt="image" src="https://github.com/user-attachments/assets/5abde373-8a37-4ab8-8193-fb7112b97104" /> | <img width="676" height="362" alt="image" src="https://github.com/user-attachments/assets/ef5d0724-6a91-4af7-8e9d-59025a9eba87" /> | <!-- ## Preview links If relevant, include links to changed pages for easy review access. Copy the preview base URL from the Vercel bot comment on this PR. Use the following table as an example template. | Site | Live | Preview | Search for | | -------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ----------------------------- | | WWW | [/blog/your-post](https://supabase.com/blog/your-post) | [/blog/your-post](https://zone-www-dot-com-git-branch-name-supabase.vercel.app/blog/your-post) | unique phrase from the change | | Docs | [/docs/guides/your-page](https://supabase.com/docs/guides/your-page) | [/docs/guides/your-page](https://docs-git-branch-name-supabase.vercel.app/docs/guides/your-page) | unique phrase from the change | | Studio | [/dashboard](https://supabase.com/dashboard) | [/dashboard](https://studio-git-branch-name-supabase.vercel.app/dashboard) | unique phrase from the change | | Design system | [/design-system](https://supabase.com/design-system) | [/design-system](https://design-system-git-branch-name-supabase.vercel.app/design-system) | unique phrase from the change | | UI library | [/library](https://supabase.com/library) | [/library](https://ui-library-git-branch-name-supabase.vercel.app/library) | unique phrase from the change | | Knowledge base | [/kb/guides/your-page](https://supabase.com/kb/guides/your-page) | [/kb/guides/your-page](https://kb-git-branch-name-supabase.vercel.app/kb/guides/your-page) | unique phrase from the change | --> <!-- ## Additional context Optionally add any other context or screenshots. --> ## Review instructions 1. run `pnpm dev:www` and open `http://localhost:3000/brand-assets` 2. in the gallery, copy and download one file of each group, and make sure that each file opens 3. click "Copy agent prompt", and make sure that the copied text names `https://supabase.com/brand-assets.md` 4. open `http://localhost:3000/brand-assets.md`, and make sure that it links each svg and png file 5. right-click the nav logo, hover "Copy logo" and "Copy wordmark", and make sure that the frame moves to the part that each item copies 6. click "Copy wordmark" in the light theme and in the dark theme, and make sure that the pasted svg has black and then white lettering 7. run `pnpm --filter www exec vitest run data/brand-assets.test.ts`, and make sure that the tests pass ## Checklist Check all before review: - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
No files matched your search
@@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import Link from 'next/link'
|
||||
import { type CSSProperties, type PropsWithChildren, type ReactNode } from 'react'
|
||||
import { type PropsWithChildren, type ReactNode } from 'react'
|
||||
import {
|
||||
cn,
|
||||
DropdownMenu,
|
||||
@@ -11,7 +11,8 @@ import {
|
||||
IconGitHubSolid,
|
||||
} from 'ui'
|
||||
import { Admonition } from 'ui-patterns/Admonition'
|
||||
import { getNotchFocusRing, getNotchMask, getNotchOutline } from 'ui-patterns/Notch'
|
||||
import { getNotchFocusRing, getNotchStyle } from 'ui-patterns/Notch'
|
||||
import { NotchOutline } from 'ui-patterns/Notch/NotchOutline'
|
||||
|
||||
interface CodeSampleWrapperProps {
|
||||
source: string | URL | (string | URL)[]
|
||||
@@ -31,7 +32,7 @@ interface SourceFrameProps {
|
||||
}
|
||||
|
||||
export const SOURCE_FOOTER_CLASSES = cn(
|
||||
'not-prose absolute right-0 bottom-0 z-1 flex h-8 w-(--source-notch-width) items-center gap-2 px-3 whitespace-nowrap',
|
||||
'not-prose absolute right-0 bottom-0 z-1 flex h-8 w-(--notch-width) items-center gap-2 px-3 whitespace-nowrap',
|
||||
'text-xs text-foreground-lighter no-underline transition-colors hover:text-foreground',
|
||||
'focus-inset rounded-md'
|
||||
)
|
||||
@@ -127,37 +128,21 @@ export function SourceFrame({
|
||||
footer,
|
||||
notchWidth = DEFAULT_NOTCH_WIDTH,
|
||||
}: PropsWithChildren<SourceFrameProps>) {
|
||||
const outline = getNotchOutline(notchWidth)
|
||||
const notchStyle = {
|
||||
'--source-notch-width': `${notchWidth}px`,
|
||||
'--source-notch-mask': getNotchMask(notchWidth),
|
||||
'--source-notch-mask-width': `${notchWidth + 10}px`,
|
||||
} as CSSProperties
|
||||
|
||||
return (
|
||||
<div
|
||||
style={notchStyle}
|
||||
style={getNotchStyle(notchWidth)}
|
||||
className="group/source code-sample-source shiki-wrapper relative w-full [&_.shiki]:pb-8 [&_.shiki]:shadow-none!"
|
||||
>
|
||||
<div className="codeblock-drop-shadow relative has-[.code-scroll:focus-visible]:z-1">
|
||||
{children}
|
||||
</div>
|
||||
<svg
|
||||
aria-hidden
|
||||
width={notchWidth + 8}
|
||||
height="40"
|
||||
viewBox={`0 0 ${notchWidth + 8} 40`}
|
||||
fill="none"
|
||||
className="pointer-events-none absolute right-0 bottom-0 z-1 overflow-visible"
|
||||
>
|
||||
<path d={outline} className="stroke-background-200" />
|
||||
<path d={outline} className="stroke-border" />
|
||||
<NotchOutline width={notchWidth} surfaceClassName="stroke-background-200" className="z-1">
|
||||
<path
|
||||
d={getNotchFocusRing(notchWidth)}
|
||||
strokeWidth={2}
|
||||
className="hidden stroke-ring group-has-[.code-scroll:focus-visible]/source:inline"
|
||||
/>
|
||||
</svg>
|
||||
</NotchOutline>
|
||||
{footer}
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -16,9 +16,5 @@
|
||||
}
|
||||
|
||||
.code-sample-source :is(.shiki, .code-sample-surface) {
|
||||
mask:
|
||||
linear-gradient(#000 0 0),
|
||||
var(--source-notch-mask) right -2px bottom -2px / var(--source-notch-mask-width) 42px no-repeat;
|
||||
mask-composite: exclude;
|
||||
mask-clip: no-clip;
|
||||
@apply notch-corner;
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
@import 'config/inline-code.css';
|
||||
@import 'ui-patterns/CodeBlock/code-block.css';
|
||||
@import 'ui-patterns/Toc/toc-menu.css';
|
||||
@import 'ui-patterns/Notch/notch.css';
|
||||
@import './code-block.css';
|
||||
@import './reference.css';
|
||||
@import 'docs-search/styles.css';
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { ArrowRight } from 'lucide-react'
|
||||
import { useId, type CSSProperties } from 'react'
|
||||
import { useId } from 'react'
|
||||
import { cn } from 'ui'
|
||||
import { getNotchMask, getNotchOutline } from 'ui-patterns/Notch'
|
||||
import { getNotchStyle } from 'ui-patterns/Notch'
|
||||
import { NotchOutline } from 'ui-patterns/Notch/NotchOutline'
|
||||
|
||||
import type { FeaturedItem } from '../lib/guides'
|
||||
import { bindRevealOnce, REVEAL_GROUP_CLASS, REVEAL_ITEM_CLASS, revealStyle } from '../lib/reveal'
|
||||
@@ -19,15 +20,8 @@ interface FeaturedCoverProps {
|
||||
hasDates: boolean
|
||||
}
|
||||
|
||||
type NotchStyle = CSSProperties & { '--notch-width': string; '--notch-mask': string }
|
||||
|
||||
const NOTCH_WIDTH = 40
|
||||
|
||||
const NOTCH_STYLE: NotchStyle = {
|
||||
'--notch-width': `${NOTCH_WIDTH}px`,
|
||||
'--notch-mask': getNotchMask(NOTCH_WIDTH),
|
||||
}
|
||||
|
||||
export const FeaturedSection = ({ title, items, className }: FeaturedSectionProps) => {
|
||||
const headingId = useId()
|
||||
const hasDates = items.some((item) => item.date)
|
||||
@@ -70,7 +64,7 @@ export const FeaturedSection = ({ title, items, className }: FeaturedSectionProp
|
||||
const FeaturedCover = ({ item, hasDates }: FeaturedCoverProps) => (
|
||||
<a
|
||||
href={item.href}
|
||||
style={NOTCH_STYLE}
|
||||
style={getNotchStyle(NOTCH_WIDTH)}
|
||||
className="group/cover relative block rounded-lg focus-ring"
|
||||
>
|
||||
<div className="drop-shadow-raised">
|
||||
@@ -79,20 +73,14 @@ const FeaturedCover = ({ item, hasDates }: FeaturedCoverProps) => (
|
||||
description={item.description}
|
||||
topics={item.topics}
|
||||
date={hasDates ? (item.date ?? '') : undefined}
|
||||
className={cn('cover-notch', hasDates ? 'h-115.5' : 'h-107.5')}
|
||||
className={cn('notch-corner shadow-none!', hasDates ? 'h-115.5' : 'h-107.5')}
|
||||
/>
|
||||
</div>
|
||||
<svg
|
||||
aria-hidden
|
||||
width={NOTCH_WIDTH + 8}
|
||||
height="40"
|
||||
viewBox={`0 0 ${NOTCH_WIDTH + 8} 40`}
|
||||
fill="none"
|
||||
className="pointer-events-none absolute right-0 bottom-0 z-20 overflow-visible"
|
||||
>
|
||||
<path d={getNotchOutline(NOTCH_WIDTH)} className="stroke-(--background-surface-75)" />
|
||||
<path d={getNotchOutline(NOTCH_WIDTH)} className="stroke-border" />
|
||||
</svg>
|
||||
<NotchOutline
|
||||
width={NOTCH_WIDTH}
|
||||
surfaceClassName="stroke-(--background-surface-75)"
|
||||
className="z-20"
|
||||
/>
|
||||
<span
|
||||
aria-hidden
|
||||
className="pointer-events-none absolute right-0 bottom-0 z-20 flex h-8 w-(--notch-width) items-center justify-center overflow-hidden"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
@import 'config/inline-code.css';
|
||||
@import 'ui-patterns/CodeBlock/code-block.css';
|
||||
@import 'ui-patterns/Toc/toc-menu.css';
|
||||
@import 'ui-patterns/Notch/notch.css';
|
||||
@import './utilities.css';
|
||||
@import './keyframes.css';
|
||||
@import 'docs-search/styles.css';
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
.cover-notch {
|
||||
mask:
|
||||
linear-gradient(#000 0 0),
|
||||
var(--notch-mask) right -2px bottom -2px / calc(var(--notch-width) + 10px) 42px no-repeat;
|
||||
mask-composite: exclude;
|
||||
mask-clip: no-clip;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
@utility section-container {
|
||||
@apply w-full mx-auto max-w-6xl px-6;
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@
|
||||
"data/solutions/vibe-coders.tsx": 1,
|
||||
"pages/assistant.tsx": 2,
|
||||
"pages/beta.tsx": 2,
|
||||
"pages/brand-assets.tsx": 2,
|
||||
"pages/brand.tsx": 2,
|
||||
"pages/modules/cron.tsx": 1,
|
||||
"pages/modules/queues.tsx": 1,
|
||||
"pages/modules/vector.tsx": 1,
|
||||
|
||||
@@ -0,0 +1,592 @@
|
||||
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<string>
|
||||
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<Canvas, string> = {
|
||||
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) => (
|
||||
<div className={cn('section-container flex flex-col gap-20 py-16 md:py-24', className)}>
|
||||
{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 (
|
||||
<AssetSection
|
||||
key={group.id}
|
||||
id={group.id}
|
||||
title={group.title}
|
||||
description={group.description}
|
||||
>
|
||||
{panes.map(({ canvas, asset }) => (
|
||||
<Pane
|
||||
key={`${asset.id}:${canvas}`}
|
||||
caption={CANVAS_CAPTIONS[canvas]}
|
||||
snippet={{
|
||||
src: `https://supabase.com${asset.svg}`,
|
||||
alt: 'Supabase',
|
||||
width: Math.round((SNIPPET_HEIGHT * asset.pngWidth) / asset.pngHeight),
|
||||
height: SNIPPET_HEIGHT,
|
||||
}}
|
||||
assetName={asset.name}
|
||||
getCopyText={() => 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'
|
||||
)}
|
||||
>
|
||||
<Image
|
||||
src={asset.svg}
|
||||
alt={
|
||||
canvas === 'dark' && asset.canvas === 'any'
|
||||
? ''
|
||||
: `Supabase ${asset.name.toLowerCase()}`
|
||||
}
|
||||
width={asset.pngWidth}
|
||||
height={asset.pngHeight}
|
||||
className={cn('max-w-full', group.imageClassName)}
|
||||
/>
|
||||
</Pane>
|
||||
))}
|
||||
</AssetSection>
|
||||
)
|
||||
})}
|
||||
<AssetSection
|
||||
title="Colors"
|
||||
description="Supabase green is the main color of the logo symbol. Use the grays for backgrounds behind the logo. The files already have the logo colors, so do not repaint the logo. Each value is valid CSS."
|
||||
>
|
||||
<ColorPalette colors={COLORS} />
|
||||
</AssetSection>
|
||||
<AssetSection
|
||||
title="Integrations"
|
||||
description={
|
||||
<>
|
||||
Use the Connect Supabase button to start the OAuth 2.0 flow in your{' '}
|
||||
<a
|
||||
href="/docs/guides/platform/oauth-apps/build-a-supabase-integration"
|
||||
className="text-foreground underline"
|
||||
>
|
||||
Supabase integration
|
||||
</a>
|
||||
. Do not use the button as a logo.
|
||||
</>
|
||||
}
|
||||
>
|
||||
{CONNECT_BUTTONS.map((button) => (
|
||||
<Pane
|
||||
key={button.canvas}
|
||||
caption={CANVAS_CAPTIONS[button.canvas]}
|
||||
snippet={{ src: button.svg, alt: 'Connect Supabase', width: 156, height: 31 }}
|
||||
assetName={button.alt}
|
||||
getCopyText={() => 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'
|
||||
)}
|
||||
>
|
||||
<Image src={button.svg} alt={button.alt} width={156} height={31} />
|
||||
</Pane>
|
||||
))}
|
||||
</AssetSection>
|
||||
</div>
|
||||
)
|
||||
|
||||
const AssetSection = ({ id, title, description, children }: AssetSectionProps) => (
|
||||
<section id={id} className="flex scroll-mt-24 flex-col gap-6">
|
||||
<header className="flex max-w-2xl flex-col gap-2">
|
||||
<h2 className="m-0 text-3xl tracking-tight text-foreground">{title}</h2>
|
||||
<p className="m-0 text-balance text-base text-foreground-light">{description}</p>
|
||||
</header>
|
||||
<div className="grid grid-cols-1 gap-6 md:grid-cols-2">{children}</div>
|
||||
</section>
|
||||
)
|
||||
|
||||
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 (
|
||||
<div className="group/pane flex flex-col gap-2 rounded-xl border border-default p-2">
|
||||
<div style={getNotchStyle(NOTCH_WIDTH)} className="relative h-80">
|
||||
<MotionConfig reducedMotion="user">
|
||||
<div className="notch-corner absolute inset-0 rounded-lg border border-default bg-surface-75">
|
||||
<motion.div
|
||||
layout
|
||||
initial={false}
|
||||
animate={{ borderRadius: isCodeOpen ? 6 : 11 }}
|
||||
transition={{ ...MORPH_TRANSITION, delay: isCodeOpen ? 0 : 0.12 }}
|
||||
className={cn(
|
||||
'absolute flex',
|
||||
className,
|
||||
isCodeOpen ? 'left-3 top-3 h-8 p-1.5' : 'inset-0'
|
||||
)}
|
||||
>
|
||||
{isCodeOpen ? null : (
|
||||
<button
|
||||
type="button"
|
||||
aria-hidden
|
||||
tabIndex={-1}
|
||||
onClick={handleCopy}
|
||||
data-copy-canvas
|
||||
className="absolute inset-0 cursor-pointer"
|
||||
/>
|
||||
)}
|
||||
<motion.div
|
||||
layout
|
||||
transition={{ ...MORPH_TRANSITION, delay: isCodeOpen ? 0 : 0.12 }}
|
||||
className={cn('flex', isCodeOpen && 'h-full [&_img]:h-full [&_img]:w-auto')}
|
||||
>
|
||||
{children}
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
<Tabs
|
||||
defaultValue="html"
|
||||
inert={!isCodeOpen}
|
||||
className={cn(
|
||||
'absolute inset-x-0 top-3 flex flex-col gap-3',
|
||||
'transition duration-200 ease-out motion-reduce:transition-opacity',
|
||||
isCodeOpen ? 'opacity-100 delay-200' : 'translate-y-1 opacity-0'
|
||||
)}
|
||||
>
|
||||
<TabsList className="mr-3 h-8 self-end border-b-0 has-[[data-tab-indicator]]:after:hidden">
|
||||
{SNIPPET_FORMATS.map((format) => (
|
||||
<TabsTrigger
|
||||
key={format.value}
|
||||
value={format.value}
|
||||
className="relative z-1 h-8 rounded-md text-xs data-[state=active]:shadow-none"
|
||||
>
|
||||
<span className="px-3">{format.label}</span>
|
||||
</TabsTrigger>
|
||||
))}
|
||||
<TabsIndicator className="top-0 h-full rounded-md bg-surface-300" />
|
||||
</TabsList>
|
||||
{SNIPPET_FORMATS.map((format) => {
|
||||
const lines = format.toLines(snippet)
|
||||
const code = lines.map((line) => line.map(([text]) => text).join('')).join('\n')
|
||||
return (
|
||||
<TabsContent key={format.value} value={format.value} className="mt-0">
|
||||
<CodeBlockFrame
|
||||
compact
|
||||
lang={format.language}
|
||||
lineCount={lines.length}
|
||||
controls={<CodeBlockControls content={code} defaultWrapped />}
|
||||
>
|
||||
<CodeBlockTokens lineNumbers lines={lines} />
|
||||
</CodeBlockFrame>
|
||||
</TabsContent>
|
||||
)
|
||||
})}
|
||||
</Tabs>
|
||||
</div>
|
||||
</MotionConfig>
|
||||
<NotchOutline width={NOTCH_WIDTH} surfaceClassName="stroke-(--background-surface-75)" />
|
||||
<button
|
||||
type="button"
|
||||
tabIndex={0}
|
||||
onClick={handleCodeClick}
|
||||
className={cn(
|
||||
'absolute bottom-0 right-0 flex h-8 w-(--notch-width) items-center justify-center gap-1.5 rounded-md',
|
||||
'font-mono text-xs text-foreground-light transition-colors hover:text-foreground focus-ring'
|
||||
)}
|
||||
>
|
||||
{isCodeOpen ? (
|
||||
<>
|
||||
<span className="sr-only">Show preview for {assetName}: </span>
|
||||
Preview
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Code aria-hidden className="size-3.5" />
|
||||
<span className="sr-only">Show code for {assetName}: </span>
|
||||
Code
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center justify-between gap-2 pl-2 pt-1">
|
||||
<span className="text-sm text-foreground-lighter">{caption}</span>
|
||||
<div className="flex gap-1.5">
|
||||
<button
|
||||
type="button"
|
||||
tabIndex={0}
|
||||
onClick={handleCopy}
|
||||
className={cn(
|
||||
'inline-flex cursor-pointer items-center gap-1.5 rounded-md border border-default bg-surface-100 py-1 pr-2 pl-1.5',
|
||||
'font-mono text-xs text-foreground-light',
|
||||
'transition-colors hover:bg-surface-200 hover:text-foreground focus-ring',
|
||||
'group-has-[[data-copy-canvas]:hover]/pane:bg-surface-200 group-has-[[data-copy-canvas]:hover]/pane:text-foreground'
|
||||
)}
|
||||
>
|
||||
<CrossfadeIcon
|
||||
isActive={isCopied}
|
||||
activeIcon={<CircleCheckFilled className="size-3" />}
|
||||
inactiveIcon={<Copy className="size-3" />}
|
||||
className="size-3"
|
||||
/>
|
||||
<span className="sr-only">
|
||||
{isCopied ? 'Copied ' : 'Copy '}
|
||||
{assetName} as{' '}
|
||||
</span>
|
||||
SVG
|
||||
</button>
|
||||
{downloads.map((download) => (
|
||||
<a
|
||||
key={download.href}
|
||||
href={download.href}
|
||||
download
|
||||
className={cn(
|
||||
'inline-flex items-center gap-1.5 rounded-md border border-default bg-surface-100 py-1 pr-2 pl-1.5',
|
||||
'font-mono text-xs text-foreground-light',
|
||||
'transition-colors hover:bg-surface-200 hover:text-foreground focus-ring'
|
||||
)}
|
||||
>
|
||||
<Download aria-hidden className="size-3" />
|
||||
<span className="sr-only">Download {assetName} as </span>
|
||||
{download.label}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const ColorPalette = ({ colors }: { colors: BrandColor[] }) => {
|
||||
const [copied, setCopied] = useState<string | null>(null)
|
||||
const [hoveredRow, setHoveredRow] = useState<string | null>(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 (
|
||||
<MotionConfig reducedMotion="user">
|
||||
<div className="grid grid-cols-1 gap-6 md:col-span-2 md:grid-cols-3">
|
||||
{colors.map((color) => (
|
||||
<article
|
||||
key={color.token}
|
||||
className="flex flex-col gap-2 rounded-xl border border-default p-2"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
aria-hidden
|
||||
tabIndex={-1}
|
||||
onClick={() => handleCopy(`${color.token}:HEX`, color.hex)}
|
||||
className="flex cursor-pointer flex-col items-stretch"
|
||||
>
|
||||
<span
|
||||
style={{ backgroundColor: color.value }}
|
||||
className="control-surface-shadows raised-control-surface block h-12 w-full rounded-lg"
|
||||
/>
|
||||
</button>
|
||||
<div className="flex flex-col gap-0.5 p-3">
|
||||
<h3 className="m-0 text-base text-foreground">{color.name}</h3>
|
||||
<p className="m-0 font-mono text-xs text-foreground-lighter">{color.token}</p>
|
||||
</div>
|
||||
<dl
|
||||
className={cn(
|
||||
'relative isolate m-0 flex flex-col overflow-hidden rounded-lg border border-default',
|
||||
'[&>div:hover]:before:opacity-0 [&>div:has(+div:hover)]:before:opacity-0'
|
||||
)}
|
||||
>
|
||||
{hoveredRow?.startsWith(`${color.token}:`) ? null : (
|
||||
<motion.span
|
||||
layoutId={`${color.token}:row-highlight`}
|
||||
transition={ROW_HIGHLIGHT_TRANSITION}
|
||||
className="absolute inset-0 -z-10 bg-surface-200"
|
||||
/>
|
||||
)}
|
||||
{[
|
||||
{ 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 (
|
||||
<div
|
||||
key={format.label}
|
||||
onPointerEnter={() => 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 ? (
|
||||
<motion.span
|
||||
layoutId={`${color.token}:row-highlight`}
|
||||
transition={ROW_HIGHLIGHT_TRANSITION}
|
||||
className="absolute inset-0 -z-10 bg-surface-200"
|
||||
/>
|
||||
) : null}
|
||||
<dt className="w-12 font-mono text-xs text-foreground-lighter transition-colors group-hover/row:text-foreground-light">
|
||||
{format.label}
|
||||
</dt>
|
||||
<dd className="m-0 flex-1 truncate font-mono text-xs text-foreground-light transition-colors group-hover/row:text-foreground">
|
||||
{format.value}
|
||||
</dd>
|
||||
<button
|
||||
type="button"
|
||||
tabIndex={0}
|
||||
onClick={() => handleCopy(key, format.value)}
|
||||
className={cn(
|
||||
'flex size-7 items-center justify-center rounded-md text-foreground-lighter transition-colors focus-ring',
|
||||
'group-hover/row:text-foreground',
|
||||
'after:absolute after:inset-0 after:cursor-pointer'
|
||||
)}
|
||||
>
|
||||
<CrossfadeIcon
|
||||
isActive={isCopied}
|
||||
activeIcon={<CircleCheckFilled className="size-3.5" />}
|
||||
inactiveIcon={<Copy className="size-3" />}
|
||||
className={cn(
|
||||
'size-3.5 transition-opacity',
|
||||
!isCopied && 'opacity-0 group-has-[:focus-visible]/row:opacity-100'
|
||||
)}
|
||||
/>
|
||||
<span className="sr-only">
|
||||
{isCopied ? 'Copied' : 'Copy'} {color.name} {format.label}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</dl>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</MotionConfig>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,486 @@
|
||||
import { useId, useRef, useState, type MouseEvent, type PointerEvent } from 'react'
|
||||
import { useClickAway } from 'react-use'
|
||||
import { cn } from 'ui'
|
||||
import { GlyphLines } from 'ui-patterns/GlyphLines'
|
||||
|
||||
import {
|
||||
COLUMNS,
|
||||
fromHandleView,
|
||||
INITIAL_SHAPES,
|
||||
LETTER_PATHS,
|
||||
offsetPoint,
|
||||
ROWS,
|
||||
SLANT,
|
||||
SLANT_ORIGINS,
|
||||
SYMBOL_HEIGHT,
|
||||
SYMBOL_OUTLINE,
|
||||
SYMBOL_WIDTH,
|
||||
toHandleView,
|
||||
toPathData,
|
||||
WORDMARK_COLUMNS,
|
||||
WORDMARK_ROWS,
|
||||
WORDMARK_WIDTH,
|
||||
type PathNode,
|
||||
type Point,
|
||||
} from './logo-geometry'
|
||||
|
||||
export interface VectorLogoProps {
|
||||
guideText: string
|
||||
className?: string
|
||||
}
|
||||
|
||||
type DragTarget = (typeof DRAG_TARGETS)[number]
|
||||
|
||||
interface NodeRef {
|
||||
shape: number
|
||||
subpath: number
|
||||
node: number
|
||||
}
|
||||
|
||||
// gradientId names the overlay gradient, and the drop shadow filter is `${gradientId}-shadow`
|
||||
interface RaisedPathsProps {
|
||||
paths: { key: string; d: string }[]
|
||||
gradientId: string
|
||||
}
|
||||
|
||||
interface Drag {
|
||||
ref: NodeRef
|
||||
target: DragTarget
|
||||
start: Point
|
||||
node: PathNode
|
||||
}
|
||||
|
||||
// px per symbol unit. the viewBox draws 1:1, so a 1 unit stroke stays 1px at any scale
|
||||
const SCALE = 1.1
|
||||
const PADDING = 24
|
||||
// a guide runs this far from the symbol. it must pass every edge of the hero
|
||||
const REACH = 2400
|
||||
const HATCH_SPACING = 6
|
||||
const MORPH_TRANSITION =
|
||||
'transition-[transform,opacity] duration-500 ease-out motion-reduce:transition-none'
|
||||
|
||||
const DRAG_TARGETS = ['point', 'in', 'out'] as const
|
||||
|
||||
const getAnchorSize = (shapeIndex: number) => (shapeIndex === 0 ? 7 : 5)
|
||||
|
||||
// lines draw in order, and undraw in reverse after the fill fades out
|
||||
const getDrawDelay = ({
|
||||
index,
|
||||
count,
|
||||
isDrawn,
|
||||
}: {
|
||||
index: number
|
||||
count: number
|
||||
isDrawn: boolean
|
||||
}) => (isDrawn ? index * 60 : 300 + (count - 1 - index) * 60)
|
||||
|
||||
export const VectorLogo = ({ guideText, className }: VectorLogoProps) => {
|
||||
const [mode, setMode] = useState<'icon' | 'wordmark'>('icon')
|
||||
const [shapes, setShapes] = useState(INITIAL_SHAPES)
|
||||
const [selected, setSelected] = useState<NodeRef | null>(null)
|
||||
const dragRef = useRef<Drag | null>(null)
|
||||
const canvasRef = useRef<HTMLDivElement>(null)
|
||||
// the guide lines have no stroke. GlyphLines draws them, and marks the svg ready so the draw-in waits for hydration
|
||||
const guidesRef = useRef<SVGSVGElement>(null)
|
||||
const gradientId = useId()
|
||||
const hatchId = useId()
|
||||
const isWordmark = mode === 'wordmark'
|
||||
const subjectWidth = isWordmark ? WORDMARK_WIDTH : SYMBOL_WIDTH
|
||||
const width = WORDMARK_WIDTH * SCALE + PADDING * 2
|
||||
const height = SYMBOL_HEIGHT * SCALE + PADDING * 2
|
||||
const toView = (value: number) => value * SCALE + PADDING
|
||||
const shiftStyle = {
|
||||
transform: `translateX(${((WORDMARK_WIDTH - subjectWidth) / 2) * SCALE}px)`,
|
||||
}
|
||||
const contentTransform = `translate(${PADDING} ${PADDING}) scale(${SCALE})`
|
||||
const [symbolShape, ...letterShapes] = shapes
|
||||
const symbolPath = toPathData(symbolShape)
|
||||
const letterPaths = letterShapes.map(toPathData)
|
||||
const isShapeShown = (shapeIndex: number) => shapeIndex === 0 || isWordmark
|
||||
const selectedNode =
|
||||
selected && isShapeShown(selected.shape)
|
||||
? shapes[selected.shape][selected.subpath][selected.node]
|
||||
: null
|
||||
const handleViews = selectedNode
|
||||
? (['in', 'out'] as const).flatMap((target) => {
|
||||
const handle = selectedNode[target]
|
||||
return handle
|
||||
? [{ target, view: toHandleView({ anchor: selectedNode.point, handle, scale: SCALE }) }]
|
||||
: []
|
||||
})
|
||||
: []
|
||||
const slantLength = Math.hypot(SLANT.dx, SLANT.dy)
|
||||
const guides = [
|
||||
...ROWS.map((y) => [-REACH, toView(y), REACH, toView(y)]),
|
||||
...COLUMNS.map((x) => [toView(x), -REACH, toView(x), REACH]),
|
||||
...SLANT_ORIGINS.map(([x, y]) => {
|
||||
const dx = (SLANT.dx / slantLength) * REACH
|
||||
const dy = (SLANT.dy / slantLength) * REACH
|
||||
return [toView(x) - dx, toView(y) - dy, toView(x) + dx, toView(y) + dy]
|
||||
}),
|
||||
]
|
||||
|
||||
const wordmarkGuides = [
|
||||
...WORDMARK_ROWS.map((y) => [-REACH, toView(y), REACH, toView(y)]),
|
||||
...WORDMARK_COLUMNS.map((x) => [toView(x), -REACH, toView(x), REACH]),
|
||||
]
|
||||
|
||||
const svgProps = {
|
||||
width,
|
||||
height,
|
||||
viewBox: `0 0 ${width} ${height}`,
|
||||
fill: 'none',
|
||||
}
|
||||
|
||||
const handleCanvasPointerDown = () => setSelected(null)
|
||||
|
||||
const handleLogoClick = () => setMode(isWordmark ? 'icon' : 'wordmark')
|
||||
|
||||
useClickAway(canvasRef, () => setSelected(null))
|
||||
|
||||
// every point carries its place in data attributes, so one handler serves all of them
|
||||
const handlePointPointerDown = (event: PointerEvent<SVGElement>) => {
|
||||
if (event.button !== 0) return
|
||||
event.stopPropagation()
|
||||
const { dataset } = event.currentTarget
|
||||
const ref = {
|
||||
shape: Number(dataset.shape),
|
||||
subpath: Number(dataset.subpath),
|
||||
node: Number(dataset.node),
|
||||
}
|
||||
const target = DRAG_TARGETS.find((value) => value === dataset.target) ?? 'point'
|
||||
event.currentTarget.setPointerCapture(event.pointerId)
|
||||
dragRef.current = {
|
||||
ref,
|
||||
target,
|
||||
start: [event.clientX, event.clientY],
|
||||
node: shapes[ref.shape][ref.subpath][ref.node],
|
||||
}
|
||||
if (target === 'point') setSelected(ref)
|
||||
}
|
||||
|
||||
const handlePointPointerMove = (event: PointerEvent<SVGElement>) => {
|
||||
const drag = dragRef.current
|
||||
if (!drag) return
|
||||
const { node, target } = drag
|
||||
const dx = (event.clientX - drag.start[0]) / SCALE
|
||||
const dy = (event.clientY - drag.start[1]) / SCALE
|
||||
const handle = target === 'point' ? undefined : node[target]
|
||||
const moved = handle
|
||||
? {
|
||||
...node,
|
||||
[target]: fromHandleView({
|
||||
anchor: node.point,
|
||||
view:
|
||||
offsetPoint({
|
||||
point: toHandleView({ anchor: node.point, handle, scale: SCALE }),
|
||||
dx,
|
||||
dy,
|
||||
}) ?? handle,
|
||||
scale: SCALE,
|
||||
}),
|
||||
}
|
||||
: {
|
||||
id: node.id,
|
||||
point: [node.point[0] + dx, node.point[1] + dy] satisfies Point,
|
||||
in: offsetPoint({ point: node.in, dx, dy }),
|
||||
out: offsetPoint({ point: node.out, dx, dy }),
|
||||
}
|
||||
setShapes((current) => {
|
||||
const next = structuredClone(current)
|
||||
next[drag.ref.shape][drag.ref.subpath][drag.ref.node] = moved
|
||||
return next
|
||||
})
|
||||
}
|
||||
|
||||
// capture also ends on pointerup, and on a cancelled touch that sends no pointerup
|
||||
const handlePointDragEnd = () => {
|
||||
dragRef.current = null
|
||||
}
|
||||
|
||||
const handlePointDoubleClick = (event: MouseEvent<SVGElement>) => {
|
||||
const { dataset } = event.currentTarget
|
||||
const shape = Number(dataset.shape)
|
||||
const subpath = Number(dataset.subpath)
|
||||
const node = Number(dataset.node)
|
||||
setShapes((current) => {
|
||||
const next = structuredClone(current)
|
||||
next[shape][subpath][node] = INITIAL_SHAPES[shape][subpath][node]
|
||||
return next
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={cn('relative flex w-full flex-col items-center gap-6 pt-16', className)}>
|
||||
<GlyphLines
|
||||
linesRef={guidesRef}
|
||||
text={guideText}
|
||||
className={cn(
|
||||
'construction-mask absolute top-0 left-1/2 h-full w-screen -translate-x-1/2',
|
||||
'font-mono caret-background text-border-stronger [--glyph-lines-pulse:var(--color-border-control-hover)]'
|
||||
)}
|
||||
/>
|
||||
<div
|
||||
aria-hidden
|
||||
className="construction-mask pointer-events-none absolute inset-y-0 left-1/2 flex w-screen -translate-x-1/2 justify-center pt-16"
|
||||
>
|
||||
<svg {...svgProps} ref={guidesRef} className="group/guides overflow-visible">
|
||||
<defs>
|
||||
<pattern
|
||||
id={hatchId}
|
||||
width={HATCH_SPACING}
|
||||
height={HATCH_SPACING}
|
||||
patternUnits="userSpaceOnUse"
|
||||
patternTransform="rotate(45)"
|
||||
>
|
||||
<line x1={0} y1={0} x2={0} y2={HATCH_SPACING} className="stroke-border" />
|
||||
</pattern>
|
||||
<clipPath id={`${hatchId}-reveal`}>
|
||||
<rect
|
||||
x={toView(SYMBOL_WIDTH / 2) - REACH}
|
||||
y={toView(SYMBOL_HEIGHT / 2) - REACH}
|
||||
width={REACH * 2}
|
||||
height={REACH * 2}
|
||||
className={cn(
|
||||
'origin-center transform-fill motion-safe:scale-0',
|
||||
'motion-safe:group-data-glyph-lines-ready/guides:animate-reveal-hatch'
|
||||
)}
|
||||
/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
<g style={shiftStyle} className={MORPH_TRANSITION}>
|
||||
<g
|
||||
fill={`url(#${hatchId})`}
|
||||
clipPath={`url(#${hatchId}-reveal)`}
|
||||
stroke="none"
|
||||
className="opacity-60"
|
||||
>
|
||||
<rect
|
||||
x={-REACH}
|
||||
y={toView(ROWS[2])}
|
||||
width={REACH * 2}
|
||||
height={(ROWS[3] - ROWS[2]) * SCALE}
|
||||
/>
|
||||
<rect
|
||||
x={toView(COLUMNS[1])}
|
||||
y={-REACH}
|
||||
width={(COLUMNS[2] - COLUMNS[1]) * SCALE}
|
||||
height={REACH * 2}
|
||||
/>
|
||||
</g>
|
||||
{guides.map(([x1, y1, x2, y2], index) => (
|
||||
<line
|
||||
key={`${x1}:${y1}`}
|
||||
x1={x1}
|
||||
y1={y1}
|
||||
x2={x2}
|
||||
y2={y2}
|
||||
pathLength={1}
|
||||
data-glyph-line
|
||||
style={{ animationDelay: `${index * 40}ms` }}
|
||||
className="[stroke-dasharray:1] motion-safe:group-data-glyph-lines-ready/guides:animate-draw-line"
|
||||
/>
|
||||
))}
|
||||
{wordmarkGuides.map(([x1, y1, x2, y2], index) => (
|
||||
<line
|
||||
key={`${x1}:${y1}`}
|
||||
x1={x1}
|
||||
y1={y1}
|
||||
x2={x2}
|
||||
y2={y2}
|
||||
pathLength={1}
|
||||
data-glyph-line
|
||||
style={{
|
||||
transitionDelay: `${getDrawDelay({ index, count: wordmarkGuides.length, isDrawn: isWordmark })}ms`,
|
||||
}}
|
||||
className={cn(
|
||||
'[stroke-dasharray:1] transition-[stroke-dashoffset] duration-700 ease-out',
|
||||
'motion-reduce:transition-none',
|
||||
isWordmark ? '[stroke-dashoffset:0]' : '[stroke-dashoffset:1]'
|
||||
)}
|
||||
/>
|
||||
))}
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
<div
|
||||
ref={canvasRef}
|
||||
aria-hidden
|
||||
onPointerDown={handleCanvasPointerDown}
|
||||
style={{ width, height }}
|
||||
className="relative shrink-0"
|
||||
>
|
||||
<svg
|
||||
{...svgProps}
|
||||
className="control-surface-shadows raised-svg-surface absolute inset-0 overflow-visible"
|
||||
>
|
||||
<g style={shiftStyle} className={MORPH_TRANSITION}>
|
||||
<defs>
|
||||
<linearGradient
|
||||
id={gradientId}
|
||||
x1={0}
|
||||
y1={0}
|
||||
x2={0}
|
||||
y2={SYMBOL_HEIGHT}
|
||||
gradientUnits="userSpaceOnUse"
|
||||
>
|
||||
<stop />
|
||||
<stop offset={1} />
|
||||
</linearGradient>
|
||||
<filter id={`${gradientId}-shadow`} x="-20%" y="-20%" width="140%" height="140%">
|
||||
<feDropShadow dx={0} dy={1 / SCALE} stdDeviation={1.5 / SCALE} />
|
||||
</filter>
|
||||
</defs>
|
||||
<g transform={contentTransform} onClick={handleLogoClick} className="cursor-pointer">
|
||||
<RaisedPaths
|
||||
paths={[{ key: SYMBOL_OUTLINE, d: symbolPath }]}
|
||||
gradientId={gradientId}
|
||||
/>
|
||||
</g>
|
||||
<g
|
||||
transform={contentTransform}
|
||||
onClick={handleLogoClick}
|
||||
className={cn(
|
||||
'cursor-pointer',
|
||||
MORPH_TRANSITION,
|
||||
isWordmark ? 'opacity-100 delay-700' : 'pointer-events-none opacity-0'
|
||||
)}
|
||||
>
|
||||
<RaisedPaths
|
||||
paths={LETTER_PATHS.map((key, index) => ({ key, d: letterPaths[index] }))}
|
||||
gradientId={gradientId}
|
||||
/>
|
||||
</g>
|
||||
<g transform={contentTransform} strokeWidth={1 / SCALE} data-raised-edge>
|
||||
<path d={symbolPath} />
|
||||
{LETTER_PATHS.map((key, index) => (
|
||||
<path
|
||||
key={key}
|
||||
d={letterPaths[index]}
|
||||
pathLength={1}
|
||||
style={{
|
||||
transitionDelay: `${getDrawDelay({ index, count: LETTER_PATHS.length, isDrawn: isWordmark })}ms`,
|
||||
}}
|
||||
className={cn(
|
||||
'[stroke-dasharray:1] transition-[stroke-dashoffset] duration-700 ease-out',
|
||||
'motion-reduce:transition-none',
|
||||
isWordmark ? '[stroke-dashoffset:0]' : '[stroke-dashoffset:1]'
|
||||
)}
|
||||
/>
|
||||
))}
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
<svg {...svgProps} className="pointer-events-none absolute inset-0 overflow-visible">
|
||||
<g style={shiftStyle} className={MORPH_TRANSITION}>
|
||||
{selected && selectedNode ? (
|
||||
<g className="stroke-blue-900">
|
||||
{handleViews.map(({ target, view }) => (
|
||||
<line
|
||||
key={target}
|
||||
x1={toView(selectedNode.point[0])}
|
||||
y1={toView(selectedNode.point[1])}
|
||||
x2={toView(view[0])}
|
||||
y2={toView(view[1])}
|
||||
/>
|
||||
))}
|
||||
</g>
|
||||
) : null}
|
||||
<g strokeWidth={1}>
|
||||
{shapes.map((shape, shapeIndex) => (
|
||||
<g
|
||||
key={INITIAL_SHAPES[shapeIndex][0][0].id}
|
||||
className={cn(
|
||||
shapeIndex > 0 && MORPH_TRANSITION,
|
||||
isShapeShown(shapeIndex) ? 'pointer-events-auto opacity-100' : 'opacity-0'
|
||||
)}
|
||||
>
|
||||
{shape.map((nodes, subpathIndex) =>
|
||||
nodes.map((node, nodeIndex) => (
|
||||
<rect
|
||||
key={node.id}
|
||||
data-shape={shapeIndex}
|
||||
data-subpath={subpathIndex}
|
||||
data-node={nodeIndex}
|
||||
data-target="point"
|
||||
x={toView(node.point[0]) - getAnchorSize(shapeIndex) / 2}
|
||||
y={toView(node.point[1]) - getAnchorSize(shapeIndex) / 2}
|
||||
width={getAnchorSize(shapeIndex)}
|
||||
height={getAnchorSize(shapeIndex)}
|
||||
onPointerDown={handlePointPointerDown}
|
||||
onPointerMove={handlePointPointerMove}
|
||||
onLostPointerCapture={handlePointDragEnd}
|
||||
onDoubleClick={handlePointDoubleClick}
|
||||
className={cn(
|
||||
'touch-none',
|
||||
selectedNode === node
|
||||
? 'fill-white stroke-blue-900'
|
||||
: 'fill-background stroke-border-stronger'
|
||||
)}
|
||||
/>
|
||||
))
|
||||
)}
|
||||
</g>
|
||||
))}
|
||||
</g>
|
||||
{selected && selectedNode ? (
|
||||
<g className="pointer-events-auto fill-white stroke-blue-900" strokeWidth={1}>
|
||||
{handleViews.map(({ target, view }) => (
|
||||
<circle
|
||||
key={target}
|
||||
data-shape={selected.shape}
|
||||
data-subpath={selected.subpath}
|
||||
data-node={selected.node}
|
||||
data-target={target}
|
||||
cx={toView(view[0])}
|
||||
cy={toView(view[1])}
|
||||
r={2.5}
|
||||
onPointerDown={handlePointPointerDown}
|
||||
onPointerMove={handlePointPointerMove}
|
||||
onLostPointerCapture={handlePointDragEnd}
|
||||
onDoubleClick={handlePointDoubleClick}
|
||||
className="touch-none"
|
||||
/>
|
||||
))}
|
||||
</g>
|
||||
) : null}
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
{/* the drawing is aria-hidden, so a visually hidden button is the keyboard path to the same toggle */}
|
||||
<button
|
||||
type="button"
|
||||
tabIndex={0}
|
||||
aria-pressed={isWordmark}
|
||||
onClick={handleLogoClick}
|
||||
className={cn(
|
||||
'sr-only focus-visible:not-sr-only focus-visible:absolute focus-visible:bottom-0',
|
||||
'rounded-md border border-default bg-surface-100 px-2 py-1 text-xs text-foreground focus-ring'
|
||||
)}
|
||||
>
|
||||
Show wordmark
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// muted is translucent, so an opaque base under it carries the drop shadow and keeps the guides from showing through
|
||||
const RaisedPaths = ({ paths, gradientId }: RaisedPathsProps) => (
|
||||
<>
|
||||
<g filter={`url(#${gradientId}-shadow)`} className="fill-background">
|
||||
{paths.map(({ key, d }) => (
|
||||
<path key={key} d={d} />
|
||||
))}
|
||||
</g>
|
||||
<g className="fill-card dark:fill-muted">
|
||||
{paths.map(({ key, d }) => (
|
||||
<path key={key} d={d} />
|
||||
))}
|
||||
</g>
|
||||
<g fill={`url(#${gradientId})`}>
|
||||
{paths.map(({ key, d }) => (
|
||||
<path key={key} d={d} />
|
||||
))}
|
||||
</g>
|
||||
</>
|
||||
)
|
||||
@@ -0,0 +1,166 @@
|
||||
export type Point = [number, number]
|
||||
|
||||
export interface PathNode {
|
||||
id: string
|
||||
point: Point
|
||||
in?: Point
|
||||
out?: Point
|
||||
}
|
||||
|
||||
type Shape = PathNode[][]
|
||||
|
||||
// the symbol box and the full wordmark width, in the units of the logo SVG files. the symbol sits at the same place in both
|
||||
export const SYMBOL_WIDTH = 109
|
||||
export const SYMBOL_HEIGHT = 113
|
||||
export const WORDMARK_WIDTH = 581
|
||||
|
||||
export const ROWS = [0, 40.06, 56.2, 72.29, SYMBOL_HEIGHT]
|
||||
export const COLUMNS = [0, 54.2, SYMBOL_WIDTH]
|
||||
export const SLANT = { dx: 43.15, dy: -54.35 }
|
||||
export const SLANT_ORIGINS = [
|
||||
[2.17, 56.42],
|
||||
[106.86, 55.94],
|
||||
] as const
|
||||
// px added to every bezier handle on screen, so short corner handles stay visible and grabbable
|
||||
const HANDLE_REACH = 24
|
||||
|
||||
// the outer edge of both symbol halves. the halves overlap on the middle spine, so one path avoids a double line
|
||||
export const SYMBOL_OUTLINE =
|
||||
'M45.317 2.07103C48.1765 -1.53037 53.9745 0.442937 54.0434 5.041L54.27 40.0627H99.1935C107.384 40.0627 111.952 49.5228 106.859 55.9374L63.7076 110.284C60.8481 113.885 55.0502 111.912 54.9813 107.314L54.46 72.2922H9.83113C1.64038 72.2922 -2.92775 62.8321 2.1655 56.4175L45.317 2.07103Z'
|
||||
|
||||
// the supabase lettering, from supabase-logo-green-black-transparent.svg
|
||||
export const LETTER_PATHS = [
|
||||
'M151.397 66.7608C151.996 72.3621 157.091 81.9642 171.877 81.9642C184.764 81.9642 190.959 73.7624 190.959 65.7607C190.959 58.559 186.063 52.6577 176.373 50.6571L169.379 49.1569C166.682 48.6568 164.884 47.1565 164.884 44.7559C164.884 41.9552 167.681 39.8549 171.178 39.8549C176.772 39.8549 178.87 43.5556 179.27 46.4564L190.359 43.9558C189.76 38.6546 185.064 29.7527 171.078 29.7527C160.488 29.7527 152.696 37.0543 152.696 45.8561C152.696 52.7576 156.991 58.4591 166.482 60.5594L172.976 62.0598C176.772 62.8599 178.271 64.6605 178.271 66.8609C178.271 69.4615 176.173 71.762 171.777 71.762C165.983 71.762 163.085 68.1611 162.786 64.2602L151.397 66.7608Z',
|
||||
'M233.421 80.4639H246.109C245.909 78.7635 245.609 75.3628 245.609 71.5618V31.2529H232.321V59.8592C232.321 65.5606 228.925 69.5614 223.031 69.5614C216.837 69.5614 214.039 65.1604 214.039 59.6592V31.2529H200.752V62.3599C200.752 73.0622 207.545 81.7642 219.434 81.7642C224.628 81.7642 230.325 79.7638 233.022 75.1627C233.022 77.1631 233.221 79.4636 233.421 80.4639Z',
|
||||
'M273.076 99.4682V75.663C275.473 78.9636 280.469 81.6644 287.263 81.6644C301.149 81.6644 310.439 70.6617 310.439 55.7584C310.439 41.1553 302.148 30.1528 287.762 30.1528C280.37 30.1528 274.875 33.4534 272.677 37.2544V31.253H259.79V99.4682H273.076ZM297.352 55.8585C297.352 64.6606 291.958 69.7616 285.164 69.7616C278.372 69.7616 272.877 64.5605 272.877 55.8585C272.877 47.1566 278.372 42.0554 285.164 42.0554C291.958 42.0554 297.352 47.1566 297.352 55.8585Z',
|
||||
'M317.964 67.0609C317.964 74.7627 324.357 81.8643 334.848 81.8643C342.139 81.8643 346.835 78.4634 349.332 74.5625C349.332 76.463 349.532 79.1635 349.832 80.4639H362.02C361.72 78.7635 361.422 75.2627 361.422 72.6622V48.4567C361.422 38.5545 355.627 29.7527 340.043 29.7527C326.855 29.7527 319.761 38.2544 318.963 45.9562L330.751 48.4567C331.151 44.1558 334.348 40.455 340.141 40.455C345.737 40.455 348.434 43.3556 348.434 46.8564C348.434 48.5568 347.536 49.9572 344.738 50.3572L332.65 52.1576C324.458 53.3579 317.964 58.2589 317.964 67.0609ZM337.644 71.962C333.349 71.962 331.25 69.1614 331.25 66.2608C331.25 62.4599 333.947 60.5594 337.345 60.0594L348.434 58.359V60.5594C348.434 69.2615 343.239 71.962 337.644 71.962Z',
|
||||
'M387.703 80.4641V74.4627C390.299 78.6637 395.494 81.6644 402.288 81.6644C416.276 81.6644 425.467 70.5618 425.467 55.6585C425.467 41.0552 417.174 29.9528 402.788 29.9528C395.494 29.9528 390.1 33.1535 387.902 36.6541V8.04785H374.815V80.4641H387.703ZM412.178 55.7584C412.178 64.7605 406.784 69.7616 399.99 69.7616C393.297 69.7616 387.703 64.6606 387.703 55.7584C387.703 46.7564 393.297 41.8554 399.99 41.8554C406.784 41.8554 412.178 46.7564 412.178 55.7584Z',
|
||||
'M432.99 67.0609C432.99 74.7627 439.383 81.8643 449.873 81.8643C457.165 81.8643 461.862 78.4634 464.358 74.5625C464.358 76.463 464.559 79.1635 464.858 80.4639H477.046C476.748 78.7635 476.448 75.2627 476.448 72.6622V48.4567C476.448 38.5545 470.653 29.7527 455.068 29.7527C441.881 29.7527 434.788 38.2544 433.989 45.9562L445.776 48.4567C446.177 44.1558 449.374 40.455 455.167 40.455C460.763 40.455 463.46 43.3556 463.46 46.8564C463.46 48.5568 462.561 49.9572 459.763 50.3572L447.676 52.1576C439.484 53.3579 432.99 58.2589 432.99 67.0609ZM452.671 71.962C448.375 71.962 446.276 69.1614 446.276 66.2608C446.276 62.4599 448.973 60.5594 452.371 60.0594L463.46 58.359V60.5594C463.46 69.2615 458.265 71.962 452.671 71.962Z',
|
||||
'M485.645 66.7608C486.243 72.3621 491.339 81.9642 506.124 81.9642C519.012 81.9642 525.205 73.7624 525.205 65.7607C525.205 58.559 520.311 52.6577 510.62 50.6571L503.626 49.1569C500.929 48.6568 499.132 47.1565 499.132 44.7559C499.132 41.9552 501.928 39.8549 505.425 39.8549C511.021 39.8549 513.118 43.5556 513.519 46.4564L524.607 43.9558C524.007 38.6546 519.312 29.7527 505.326 29.7527C494.735 29.7527 486.944 37.0543 486.944 45.8561C486.944 52.7576 491.238 58.4591 500.73 60.5594L507.224 62.0598C511.021 62.8599 512.519 64.6605 512.519 66.8609C512.519 69.4615 510.421 71.762 506.025 71.762C500.23 71.762 497.334 68.1611 497.034 64.2602L485.645 66.7608Z',
|
||||
'M545.385 50.2571C545.685 45.7562 549.482 40.5549 556.375 40.5549C563.967 40.5549 567.165 45.3561 567.365 50.2571H545.385ZM568.664 63.0601C567.065 67.4609 563.668 70.5617 557.474 70.5617C550.88 70.5617 545.385 65.8606 545.087 59.3593H580.252C580.252 59.159 580.451 57.1587 580.451 55.2582C580.451 39.4547 571.361 29.7527 556.175 29.7527C543.588 29.7527 531.998 39.9548 531.998 55.6584C531.998 72.262 543.886 81.9642 557.374 81.9642C569.462 81.9642 577.255 74.8626 579.753 66.3607L568.664 63.0601Z',
|
||||
]
|
||||
|
||||
// reads paths that use only absolute M, L, H, V, C and Z commands
|
||||
const toShape = (path: string): Shape => {
|
||||
const tokens = path.match(/[MLHVCZ]|-?(?:\d+\.?\d*|\.\d+)/g) ?? []
|
||||
const read = (index: number) => Number(tokens[index])
|
||||
const subpaths: Shape = []
|
||||
let nodes: PathNode[] = []
|
||||
let index = 0
|
||||
let command = ''
|
||||
let x = 0
|
||||
let y = 0
|
||||
|
||||
while (index < tokens.length) {
|
||||
if (/[MLHVCZ]/.test(tokens[index])) command = tokens[index++]
|
||||
if (command === 'Z') {
|
||||
subpaths.push(toClosedSubpath(nodes))
|
||||
nodes = []
|
||||
continue
|
||||
}
|
||||
if (command === 'C') {
|
||||
nodes[nodes.length - 1].out = [read(index), read(index + 1)]
|
||||
x = read(index + 4)
|
||||
y = read(index + 5)
|
||||
nodes.push({ id: `${x}:${y}`, point: [x, y], in: [read(index + 2), read(index + 3)] })
|
||||
index += 6
|
||||
continue
|
||||
}
|
||||
if (command === 'M' || command === 'L') {
|
||||
x = read(index)
|
||||
y = read(index + 1)
|
||||
index += 2
|
||||
} else if (command === 'H') {
|
||||
x = read(index++)
|
||||
} else if (command === 'V') {
|
||||
y = read(index++)
|
||||
}
|
||||
nodes.push({ id: `${x}:${y}`, point: [x, y] })
|
||||
}
|
||||
|
||||
return subpaths
|
||||
}
|
||||
|
||||
// a subpath that ends on its start point closes with that last segment, so the end node merges into the start node
|
||||
const toClosedSubpath = (nodes: PathNode[]): PathNode[] => {
|
||||
const first = nodes[0]
|
||||
const last = nodes[nodes.length - 1]
|
||||
const isOnStart =
|
||||
Math.hypot(first.point[0] - last.point[0], first.point[1] - last.point[1]) < 0.01
|
||||
if (nodes.length < 2 || !isOnStart) return nodes
|
||||
return [{ ...first, in: last.in }, ...nodes.slice(1, -1)]
|
||||
}
|
||||
|
||||
const toCoords = ([x, y]: Point) => `${x} ${y}`
|
||||
|
||||
export const toPathData = (shape: Shape) =>
|
||||
shape
|
||||
.map((nodes) => {
|
||||
const segments = nodes.map((from, index) => {
|
||||
const to = nodes[(index + 1) % nodes.length]
|
||||
return from.out || to.in
|
||||
? `C${toCoords(from.out ?? from.point)} ${toCoords(to.in ?? to.point)} ${toCoords(to.point)}`
|
||||
: `L${toCoords(to.point)}`
|
||||
})
|
||||
return `M${toCoords(nodes[0].point)}${segments.join('')}Z`
|
||||
})
|
||||
.join('')
|
||||
|
||||
export const offsetPoint = ({ point, dx, dy }: { point?: Point; dx: number; dy: number }) =>
|
||||
point ? ([point[0] + dx, point[1] + dy] satisfies Point) : undefined
|
||||
|
||||
export const toHandleView = ({
|
||||
anchor,
|
||||
handle,
|
||||
scale,
|
||||
}: {
|
||||
anchor: Point
|
||||
handle: Point
|
||||
scale: number
|
||||
}): Point => {
|
||||
const length = Math.hypot(handle[0] - anchor[0], handle[1] - anchor[1]) * scale
|
||||
if (!length) return handle
|
||||
const stretch = (length + HANDLE_REACH) / length
|
||||
return [
|
||||
anchor[0] + (handle[0] - anchor[0]) * stretch,
|
||||
anchor[1] + (handle[1] - anchor[1]) * stretch,
|
||||
]
|
||||
}
|
||||
|
||||
// the inverse of toHandleView, so a dragged handle stays under the pointer
|
||||
export const fromHandleView = ({
|
||||
anchor,
|
||||
view,
|
||||
scale,
|
||||
}: {
|
||||
anchor: Point
|
||||
view: Point
|
||||
scale: number
|
||||
}): Point => {
|
||||
const length = Math.hypot(view[0] - anchor[0], view[1] - anchor[1]) * scale
|
||||
if (!length) return anchor
|
||||
const shrink = Math.max(length - HANDLE_REACH, 0) / length
|
||||
return [anchor[0] + (view[0] - anchor[0]) * shrink, anchor[1] + (view[1] - anchor[1]) * shrink]
|
||||
}
|
||||
|
||||
export const INITIAL_SHAPES = [SYMBOL_OUTLINE, ...LETTER_PATHS].map(toShape)
|
||||
|
||||
const LETTER_BOUNDS = INITIAL_SHAPES.slice(1).map((shape) => {
|
||||
const points = shape.flat().map((node) => node.point)
|
||||
const xs = points.map(([x]) => x)
|
||||
const ys = points.map(([, y]) => y)
|
||||
return {
|
||||
left: Math.min(...xs),
|
||||
right: Math.max(...xs),
|
||||
top: Math.min(...ys),
|
||||
bottom: Math.max(...ys),
|
||||
}
|
||||
})
|
||||
// the s sits on the baseline and reaches the x-height. the b sets the ascender and the p the descender
|
||||
export const WORDMARK_ROWS = [
|
||||
Math.min(...LETTER_BOUNDS.map(({ top }) => top)),
|
||||
LETTER_BOUNDS[0].top,
|
||||
LETTER_BOUNDS[0].bottom,
|
||||
Math.max(...LETTER_BOUNDS.map(({ bottom }) => bottom)),
|
||||
]
|
||||
export const WORDMARK_COLUMNS = LETTER_BOUNDS.flatMap(({ left, right }) => [left, right])
|
||||
@@ -0,0 +1,49 @@
|
||||
import { useId, type ReactNode } from 'react'
|
||||
import { cn } from 'ui'
|
||||
|
||||
export interface CrossfadeIconProps {
|
||||
isActive: boolean
|
||||
activeIcon: ReactNode
|
||||
inactiveIcon: ReactNode
|
||||
className?: string
|
||||
}
|
||||
|
||||
const iconClassName = (isShown: boolean) =>
|
||||
cn(
|
||||
'absolute inset-0 flex items-center justify-center',
|
||||
'transition duration-300 ease-[cubic-bezier(0.2,0,0,1)]',
|
||||
'motion-reduce:transition-none',
|
||||
isShown ? 'scale-100 opacity-100 blur-none' : 'scale-25 opacity-0 blur-xs'
|
||||
)
|
||||
|
||||
export const CrossfadeIcon = ({
|
||||
isActive,
|
||||
activeIcon,
|
||||
inactiveIcon,
|
||||
className,
|
||||
}: CrossfadeIconProps) => (
|
||||
<span aria-hidden className={cn('relative block size-3.5', className)}>
|
||||
<span className={iconClassName(isActive)}>{activeIcon}</span>
|
||||
<span className={iconClassName(!isActive)}>{inactiveIcon}</span>
|
||||
</span>
|
||||
)
|
||||
|
||||
export const CircleCheckFilled = ({ className }: { className?: string }) => {
|
||||
const maskId = useId()
|
||||
|
||||
return (
|
||||
<svg viewBox="0 0 24 24" fill="none" className={cn('text-foreground', className)}>
|
||||
<mask id={maskId}>
|
||||
<rect width="24" height="24" className="fill-white" />
|
||||
<path
|
||||
d="m9 12 2 2 4-4"
|
||||
className="stroke-black"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</mask>
|
||||
<circle cx="12" cy="12" r="10" fill="currentColor" mask={`url(#${maskId})`} />
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
'use client'
|
||||
|
||||
import { CheckIcon, ClipboardIcon } from '@heroicons/react/outline'
|
||||
import { CircleCheckFilled, CrossfadeIcon } from '~/components/CrossfadeIcon'
|
||||
import { Copy, Download } from 'lucide-react'
|
||||
import { useTheme } from 'next-themes'
|
||||
import { useRouter } from 'next/compat/router'
|
||||
import Link from 'next/link'
|
||||
import { Fragment, MouseEvent, ReactNode, useEffect, useRef, useState } from 'react'
|
||||
@@ -24,7 +26,10 @@ const RightClickBrandLogo = () => {
|
||||
const ref = useRef(null)
|
||||
const router = useRouter()
|
||||
const [open, setOpen] = useState<boolean>(false)
|
||||
const [copied, setCopied] = useState<boolean>(false)
|
||||
const [copiedLabel, setCopiedLabel] = useState<string | null>(null)
|
||||
const copiedTimeoutRef = useRef<ReturnType<typeof setTimeout>>(undefined)
|
||||
const [logoHighlight, setLogoHighlight] = useState<MenuItemProps['logoHighlight']>()
|
||||
const { resolvedTheme } = useTheme()
|
||||
|
||||
/**
|
||||
* Close dropdown by clicking outside
|
||||
@@ -53,6 +58,7 @@ const RightClickBrandLogo = () => {
|
||||
e.preventDefault()
|
||||
|
||||
if (e.type === 'contextmenu' || e.nativeEvent.button === 2) {
|
||||
setLogoHighlight(undefined)
|
||||
setOpen(true)
|
||||
}
|
||||
}
|
||||
@@ -77,14 +83,35 @@ const RightClickBrandLogo = () => {
|
||||
* Copy to clipboard logo SVG
|
||||
*/
|
||||
const handleCopyToClipboard = (menuItem: MenuItemProps) => {
|
||||
copyToClipboard(menuItem.clipboard ?? '', () => {
|
||||
setCopied(true)
|
||||
setTimeout(() => {
|
||||
setCopied(false)
|
||||
}, 2000)
|
||||
})
|
||||
// the ClipboardItem promise keeps the fetched copy inside the user gesture in safari
|
||||
// the copied file matches the nav logo, which follows the site theme
|
||||
const clipboardUrl =
|
||||
menuItem.clipboardUrls?.[resolvedTheme?.includes('dark') ? 'dark' : 'light']
|
||||
if (!clipboardUrl) return
|
||||
copyToClipboard(
|
||||
fetch(clipboardUrl).then((response) => {
|
||||
if (!response.ok) throw new Error(`${response.status} ${clipboardUrl}`)
|
||||
return response.text()
|
||||
}),
|
||||
() => {
|
||||
setCopiedLabel(menuItem.label)
|
||||
// an older timer would clear the newer feedback early
|
||||
clearTimeout(copiedTimeoutRef.current)
|
||||
copiedTimeoutRef.current = setTimeout(() => {
|
||||
setCopiedLabel(null)
|
||||
}, 2000)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
const handleItemPointerEnter = (menuItem: MenuItemProps) =>
|
||||
setLogoHighlight(menuItem.logoHighlight)
|
||||
|
||||
const handleMenuPointerLeave = () => setLogoHighlight(undefined)
|
||||
|
||||
const isFrameVisible = open && logoHighlight !== undefined
|
||||
const isFrameOnSymbol = logoHighlight !== 'wordmark'
|
||||
|
||||
return (
|
||||
<DropdownMenu open={open}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
@@ -93,17 +120,33 @@ const RightClickBrandLogo = () => {
|
||||
onContextMenu={handleRightClick}
|
||||
onFocus={handleKeyboardOpen}
|
||||
onKeyDown={(e) => e.key === 'Enter' && router?.push('/')}
|
||||
className="block w-auto h-6 focus-ring focus-visible:ring-offset-4 focus-visible:ring-offset-background-alternative rounded-xs"
|
||||
className={cn(
|
||||
'relative isolate block w-auto h-6 box-content -mx-2 -my-3 px-2 py-3 focus-ring focus-visible:ring-offset-background-alternative rounded-md',
|
||||
'transition-colors duration-200 ease-out motion-reduce:transition-none',
|
||||
isFrameVisible && isFrameOnSymbol && 'text-foreground-muted'
|
||||
)}
|
||||
>
|
||||
<SupabaseWordmark />
|
||||
<span
|
||||
aria-hidden
|
||||
className={cn(
|
||||
'pointer-events-none absolute inset-y-1.5 left-0.5 -z-10',
|
||||
'rounded-md bg-overlay',
|
||||
'transition-[width,scale,opacity] duration-200 ease-out motion-reduce:transition-none',
|
||||
isFrameOnSymbol ? 'w-9' : 'w-[calc(100%-0.25rem)]',
|
||||
isFrameVisible ? 'scale-100 opacity-100' : 'scale-95 opacity-0'
|
||||
)}
|
||||
/>
|
||||
</Link>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent
|
||||
autoFocus
|
||||
ref={ref}
|
||||
align="start"
|
||||
alignOffset={2}
|
||||
side="bottom"
|
||||
className="mt-2 p-0 w-52"
|
||||
onPointerLeave={handleMenuPointerLeave}
|
||||
>
|
||||
{menuItems.map((section, sectionIdx) => (
|
||||
<Fragment key={`cxtMenu-section-${sectionIdx}`}>
|
||||
@@ -111,16 +154,16 @@ const RightClickBrandLogo = () => {
|
||||
<div className="p-1">
|
||||
{section.map((menuItem, i) => (
|
||||
<DropdownMenuItem
|
||||
autoFocus
|
||||
asChild
|
||||
key={menuItem.label}
|
||||
className="w-full flex justify-between gap-2 items-center p-2!"
|
||||
onPointerEnter={() => handleItemPointerEnter(menuItem)}
|
||||
className="w-full flex justify-between gap-2 items-center p-2! cursor-pointer"
|
||||
>
|
||||
{menuItem.type === 'download' || menuItem.type === 'link' ? (
|
||||
<Link
|
||||
href={menuItem.href ?? ''}
|
||||
download={menuItem.type === 'download'}
|
||||
className="group/menu-item w-full text-left flex justify-between gap-2 items-center"
|
||||
className="w-full text-left flex justify-between gap-2 items-center"
|
||||
>
|
||||
<MenuItemContent {...menuItem} />
|
||||
</Link>
|
||||
@@ -129,10 +172,10 @@ const RightClickBrandLogo = () => {
|
||||
// DropdownMenuItem asChild manages roving tabIndex; don't override it.
|
||||
// eslint-disable-next-line supabase/require-explicit-tabindex -- in-menu item
|
||||
<button
|
||||
className="group/menu-item w-full text-left flex justify-between gap-2 items-center"
|
||||
className="w-full text-left flex justify-between gap-2 items-center"
|
||||
onClick={() => handleCopyToClipboard(menuItem)}
|
||||
>
|
||||
<MenuItemContent copied={copied} {...menuItem} />
|
||||
<MenuItemContent copied={copiedLabel === menuItem.label} {...menuItem} />
|
||||
</button>
|
||||
)
|
||||
)}
|
||||
@@ -142,6 +185,9 @@ const RightClickBrandLogo = () => {
|
||||
</Fragment>
|
||||
))}
|
||||
</DropdownMenuContent>
|
||||
<span className="sr-only" role="status">
|
||||
{copiedLabel ? 'Copied to clipboard' : ''}
|
||||
</span>
|
||||
</DropdownMenu>
|
||||
)
|
||||
}
|
||||
@@ -153,7 +199,8 @@ interface MenuItemProps {
|
||||
type: 'clipboard' | 'download' | 'link'
|
||||
icon?: ReactNode
|
||||
href?: string
|
||||
clipboard?: string
|
||||
clipboardUrls?: Record<'light' | 'dark', string>
|
||||
logoHighlight?: 'icon' | 'wordmark'
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -164,7 +211,8 @@ interface MenuItemProps {
|
||||
const menuItems: MenuItemProps[][] = [
|
||||
[
|
||||
{
|
||||
label: 'Copy logo as SVG',
|
||||
label: 'Copy logo',
|
||||
logoHighlight: 'icon',
|
||||
type: 'clipboard',
|
||||
icon: (
|
||||
<svg
|
||||
@@ -180,108 +228,45 @@ const menuItems: MenuItemProps[][] = [
|
||||
/>
|
||||
</svg>
|
||||
),
|
||||
clipboard: `<svg width="109" height="113" viewBox="0 0 109 113" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M63.7076 110.284C60.8481 113.885 55.0502 111.912 54.9813 107.314L53.9738 40.0627L99.1935 40.0627C107.384 40.0627 111.952 49.5228 106.859 55.9374L63.7076 110.284Z" fill="url(#paint0_linear)"/>
|
||||
<path d="M63.7076 110.284C60.8481 113.885 55.0502 111.912 54.9813 107.314L53.9738 40.0627L99.1935 40.0627C107.384 40.0627 111.952 49.5228 106.859 55.9374L63.7076 110.284Z" fill="url(#paint1_linear)" fill-opacity="0.2"/>
|
||||
<path d="M45.317 2.07103C48.1765 -1.53037 53.9745 0.442937 54.0434 5.041L54.4849 72.2922H9.83113C1.64038 72.2922 -2.92775 62.8321 2.1655 56.4175L45.317 2.07103Z" fill="#3ECF8E"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear" x1="53.9738" y1="54.974" x2="94.1635" y2="71.8295" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#249361"/>
|
||||
<stop offset="1" stop-color="#3ECF8E"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear" x1="36.1558" y1="30.578" x2="54.4844" y2="65.0806" gradientUnits="userSpaceOnUse">
|
||||
<stop/>
|
||||
<stop offset="1" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
`,
|
||||
clipboardUrls: {
|
||||
light: '/brand-assets/supabase-icon-green-transparent.svg',
|
||||
dark: '/brand-assets/supabase-icon-green-transparent.svg',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Copy wordmark',
|
||||
logoHighlight: 'wordmark',
|
||||
type: 'clipboard',
|
||||
icon: <Copy strokeWidth={1.5} className="size-4" />,
|
||||
clipboardUrls: {
|
||||
light: '/brand-assets/supabase-logo-green-black-transparent.svg',
|
||||
dark: '/brand-assets/supabase-logo-green-white-transparent.svg',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Download wordmark',
|
||||
type: 'download',
|
||||
icon: (
|
||||
<svg
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 16 16"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M14 10V12.6667C14 13.0203 13.8595 13.3594 13.6095 13.6095C13.3594 13.8595 13.0203 14 12.6667 14H3.33333C2.97971 14 2.64057 13.8595 2.39052 13.6095C2.14048 13.3594 2 13.0203 2 12.6667V10"
|
||||
stroke="currentColor"
|
||||
strokeWidth="1"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
<path
|
||||
d="M4.66669 6.66675L8.00002 10.0001L11.3334 6.66675"
|
||||
stroke="currentColor"
|
||||
strokeWidth="1"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
<path
|
||||
d="M8 10V2"
|
||||
stroke="currentColor"
|
||||
strokeWidth="1"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
),
|
||||
icon: <Download strokeWidth={1.5} className="size-4" />,
|
||||
href: '/supabase-wordmark.zip',
|
||||
},
|
||||
{
|
||||
label: 'Download brand assets',
|
||||
type: 'download',
|
||||
href: '/brand-assets.zip',
|
||||
icon: (
|
||||
<svg
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 16 16"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M14 10V12.6667C14 13.0203 13.8595 13.3594 13.6095 13.6095C13.3594 13.8595 13.0203 14 12.6667 14H3.33333C2.97971 14 2.64057 13.8595 2.39052 13.6095C2.14048 13.3594 2 13.0203 2 12.6667V10"
|
||||
stroke="currentColor"
|
||||
strokeWidth="1"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
<path
|
||||
d="M4.66669 6.66675L8.00002 10.0001L11.3334 6.66675"
|
||||
stroke="currentColor"
|
||||
strokeWidth="1"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
<path
|
||||
d="M8 10V2"
|
||||
stroke="currentColor"
|
||||
strokeWidth="1"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
),
|
||||
icon: <Download strokeWidth={1.5} className="size-4" />,
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
label: 'Brand Assets',
|
||||
label: 'Go to Brand Guidelines',
|
||||
type: 'link',
|
||||
href: '/brand-assets',
|
||||
href: '/brand',
|
||||
},
|
||||
],
|
||||
]
|
||||
|
||||
interface MenuItemContentProps {
|
||||
icon?: ReactNode
|
||||
type: string
|
||||
label: string
|
||||
copied?: boolean
|
||||
}
|
||||
@@ -289,28 +274,23 @@ interface MenuItemContentProps {
|
||||
/**
|
||||
* MenuItem content
|
||||
*/
|
||||
const MenuItemContent = ({ icon, type, label, copied }: MenuItemContentProps) => (
|
||||
const MenuItemContent = ({ icon, label, copied }: MenuItemContentProps) => (
|
||||
<>
|
||||
{icon && <span className="text-foreground-lighter">{icon}</span>}
|
||||
<span className="grow">{label}</span>
|
||||
{type === 'clipboard' && (
|
||||
<span className="w-4 opacity-0 flex items-center justify-center group-hover/menu-item:opacity-100 group-focus/menu-item:opacity-100 group-focus-visible/menu-item:opacity-100">
|
||||
{!copied ? (
|
||||
<ClipboardIcon
|
||||
strokeWidth={1}
|
||||
className={cn(
|
||||
'h-3 transition-opacity opacity-0 duration-300',
|
||||
!copied && 'opacity-100'
|
||||
)}
|
||||
/>
|
||||
{icon && (
|
||||
<span className="text-foreground-lighter">
|
||||
{copied === undefined ? (
|
||||
icon
|
||||
) : (
|
||||
<CheckIcon
|
||||
strokeWidth={1}
|
||||
className={cn('h-3 transition-opacity opacity-0 duration-300', copied && 'opacity-100')}
|
||||
<CrossfadeIcon
|
||||
isActive={copied}
|
||||
activeIcon={<CircleCheckFilled className="size-4" />}
|
||||
inactiveIcon={icon}
|
||||
className="size-4"
|
||||
/>
|
||||
)}
|
||||
</span>
|
||||
)}
|
||||
<span className="grow">{label}</span>
|
||||
</>
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# Supabase Brand Guidelines
|
||||
|
||||
> Official Supabase logos and colors, as SVG and PNG files for light and dark backgrounds.
|
||||
|
||||
## Which file to use
|
||||
|
||||
- Choose the file for the background where the logo appears, not for your browser or editor theme.
|
||||
- If a request asks for "the Supabase logo", use the wordmark with black lettering on a light background.
|
||||
- On a dark background, use the wordmark with white lettering.
|
||||
- In small spaces or next to other brand icons, use the green icon.
|
||||
- If you can print only one color, use the black or white one-color wordmark.
|
||||
- All files have a transparent background.
|
||||
- There is no file with the lettering alone. Every wordmark file includes the symbol.
|
||||
|
||||
## Files
|
||||
|
||||
The table lists each logo file and where to use it.
|
||||
|
||||
| Asset | Artwork | Use on | SVG | PNG |
|
||||
| ------------------------------ | -------------------------------------------------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
|
||||
| Wordmark for light backgrounds | Green symbol and black lettering, transparent background | Light backgrounds | [supabase-logo-green-black-transparent.svg](https://supabase.com/brand-assets/supabase-logo-green-black-transparent.svg) | [PNG, 2322×449](https://supabase.com/brand-assets/supabase-logo-green-black-transparent.png) |
|
||||
| Wordmark for dark backgrounds | Green symbol and white lettering, transparent background | Dark backgrounds | [supabase-logo-green-white-transparent.svg](https://supabase.com/brand-assets/supabase-logo-green-white-transparent.svg) | [PNG, 2322×449](https://supabase.com/brand-assets/supabase-logo-green-white-transparent.png) |
|
||||
| Icon | Green symbol only, no lettering, transparent background | Light or dark backgrounds | [supabase-icon-green-transparent.svg](https://supabase.com/brand-assets/supabase-icon-green-transparent.svg) | [PNG, 436×449](https://supabase.com/brand-assets/supabase-icon-green-transparent.png) |
|
||||
| One-color wordmark, black | Black symbol and lettering, transparent background | Light backgrounds | [supabase-logo-black-transparent.svg](https://supabase.com/brand-assets/supabase-logo-black-transparent.svg) | [PNG, 2000×389](https://supabase.com/brand-assets/supabase-logo-black-transparent.png) |
|
||||
| One-color wordmark, white | White symbol and lettering, transparent background | Dark backgrounds | [supabase-logo-white-transparent.svg](https://supabase.com/brand-assets/supabase-logo-white-transparent.svg) | [PNG, 2000×389](https://supabase.com/brand-assets/supabase-logo-white-transparent.png) |
|
||||
|
||||
## Colors
|
||||
|
||||
Supabase green is the main color of the logo symbol. The grays are background colors from the [Supabase design system](https://supabase.com/design-system/docs/color-usage). The logo files already have the correct colors, so do not repaint the logo with these values.
|
||||
|
||||
| Name | Token | HEX | RGB | HSL | OKLCH |
|
||||
| -------------- | ---------------- | --------- | ------------------ | ------------------------ | -------------------------- |
|
||||
| Supabase green | `brand-default` | `#3ECF8E` | `rgb(62 207 142)` | `hsl(153.1 60.2% 52.7%)` | `oklch(76.2% 0.154 159.4)` |
|
||||
| Dark gray | `gray-dark-200` | `#1C1C1C` | `rgb(28 28 28)` | `hsl(0 0% 11%)` | `oklch(22.6% 0 0)` |
|
||||
| Light gray | `gray-light-200` | `#F8F8F8` | `rgb(248 248 248)` | `hsl(0 0% 97.3%)` | `oklch(97.9% 0 0)` |
|
||||
|
||||
## Downloads
|
||||
|
||||
- [Logo kit (ZIP)](https://supabase.com/brand-assets.zip): the SVG and PNG files from the Files table.
|
||||
- [Connect Supabase button kit (ZIP)](https://obuldanrptloktxcffvn.supabase.co/storage/v1/object/public/supabase-brand-assets/connect-supabase/connect-supabase.zip): the button that starts the OAuth 2.0 flow in a [Supabase integration](https://supabase.com/docs/guides/platform/oauth-apps/build-a-supabase-integration). Do not use the button as a logo.
|
||||
|
||||
## Name
|
||||
|
||||
Write Supabase as one word, with a capital S. Do not write SupaBase or Supa Base.
|
||||
|
||||
## Usage
|
||||
|
||||
Use the Supabase logos only to refer to Supabase. Do not change the files or the logo colors.
|
||||
|
||||
Supabase and the Supabase logo are trademarks of Supabase Inc.
|
||||
@@ -109,8 +109,8 @@ const footerData = [
|
||||
url: '/kb/topics/faqs',
|
||||
},
|
||||
{
|
||||
text: 'Brand Assets',
|
||||
url: '/brand-assets',
|
||||
text: 'Brand Guidelines',
|
||||
url: '/brand',
|
||||
},
|
||||
{
|
||||
text: 'Security & Compliance',
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { BRAND_ASSETS } from './brand-assets'
|
||||
|
||||
const publicFile = (url: string) => readFileSync(path.join(process.cwd(), 'public', url))
|
||||
|
||||
describe('brand assets catalog', () => {
|
||||
it.for(BRAND_ASSETS)('$id files match the catalog', (asset) => {
|
||||
expect(publicFile(asset.svg).toString('utf-8')).toContain('<svg')
|
||||
|
||||
const png = publicFile(asset.png)
|
||||
expect([png.readUInt32BE(16), png.readUInt32BE(20)]).toEqual([asset.pngWidth, asset.pngHeight])
|
||||
})
|
||||
|
||||
it('the markdown digest links every catalog file', () => {
|
||||
const markdown = readFileSync(path.join(process.cwd(), 'content/md/brand.md'), 'utf-8')
|
||||
for (const asset of BRAND_ASSETS) {
|
||||
expect(markdown).toContain(`(https://supabase.com${asset.svg})`)
|
||||
expect(markdown).toContain(`(https://supabase.com${asset.png})`)
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,63 @@
|
||||
export interface BrandAsset {
|
||||
id: string
|
||||
name: string
|
||||
canvas: 'light' | 'dark' | 'any'
|
||||
svg: string
|
||||
png: string
|
||||
pngWidth: number
|
||||
pngHeight: number
|
||||
group: 'icon' | 'logo' | 'one-color'
|
||||
}
|
||||
|
||||
export const BRAND_ASSETS: BrandAsset[] = [
|
||||
{
|
||||
id: 'icon-green-transparent',
|
||||
group: 'icon',
|
||||
name: 'Icon',
|
||||
canvas: 'any',
|
||||
svg: '/brand-assets/supabase-icon-green-transparent.svg',
|
||||
png: '/brand-assets/supabase-icon-green-transparent.png',
|
||||
pngWidth: 436,
|
||||
pngHeight: 449,
|
||||
},
|
||||
{
|
||||
id: 'logo-green-black-transparent',
|
||||
group: 'logo',
|
||||
name: 'Wordmark for light backgrounds',
|
||||
canvas: 'light',
|
||||
svg: '/brand-assets/supabase-logo-green-black-transparent.svg',
|
||||
png: '/brand-assets/supabase-logo-green-black-transparent.png',
|
||||
pngWidth: 2322,
|
||||
pngHeight: 449,
|
||||
},
|
||||
{
|
||||
id: 'logo-green-white-transparent',
|
||||
group: 'logo',
|
||||
name: 'Wordmark for dark backgrounds',
|
||||
canvas: 'dark',
|
||||
svg: '/brand-assets/supabase-logo-green-white-transparent.svg',
|
||||
png: '/brand-assets/supabase-logo-green-white-transparent.png',
|
||||
pngWidth: 2322,
|
||||
pngHeight: 449,
|
||||
},
|
||||
{
|
||||
id: 'logo-black-transparent',
|
||||
group: 'one-color',
|
||||
name: 'One-color wordmark, black',
|
||||
canvas: 'light',
|
||||
svg: '/brand-assets/supabase-logo-black-transparent.svg',
|
||||
png: '/brand-assets/supabase-logo-black-transparent.png',
|
||||
pngWidth: 2000,
|
||||
pngHeight: 389,
|
||||
},
|
||||
{
|
||||
id: 'logo-white-transparent',
|
||||
group: 'one-color',
|
||||
name: 'One-color wordmark, white',
|
||||
canvas: 'dark',
|
||||
svg: '/brand-assets/supabase-logo-white-transparent.svg',
|
||||
png: '/brand-assets/supabase-logo-white-transparent.png',
|
||||
pngWidth: 2000,
|
||||
pngHeight: 389,
|
||||
},
|
||||
]
|
||||
@@ -14,7 +14,7 @@ const ORG_SAMEAS = [
|
||||
'https://www.instagram.com/supabasecom',
|
||||
]
|
||||
|
||||
const ORG_LOGO_URL = `${CANONICAL_ORIGIN}/images/og/supabase-og.png`
|
||||
const ORG_LOGO_URL = `${CANONICAL_ORIGIN}/brand-assets/supabase-logo-green-black-transparent.png`
|
||||
|
||||
type JsonLdSchema = Record<string, unknown> | Record<string, unknown>[]
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
module.exports = [
|
||||
{
|
||||
permanent: true,
|
||||
source: '/brand-assets',
|
||||
destination: '/brand',
|
||||
},
|
||||
{
|
||||
permanent: true,
|
||||
source: '/images/customers/logos/light/:path*',
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
import Layout from '~/components/Layouts/Default'
|
||||
import SectionContainer from '~/components/Layouts/SectionContainer'
|
||||
import * as supabaseLogoPreview from 'common/assets/images/logo-preview.jpg'
|
||||
import Container from 'components/Container'
|
||||
import CTABanner from 'components/CTABanner/index'
|
||||
import { Download } from 'lucide-react'
|
||||
import { NextSeo } from 'next-seo'
|
||||
import Image from 'next/image'
|
||||
import { useRouter } from 'next/router'
|
||||
import { Button } from 'ui'
|
||||
|
||||
const Index = () => {
|
||||
// base path for images
|
||||
const router = useRouter()
|
||||
|
||||
const meta_title = 'Branding | Supabase'
|
||||
const meta_description = 'Get Supabase Brand assets here.'
|
||||
|
||||
return (
|
||||
<>
|
||||
<NextSeo
|
||||
title={meta_title}
|
||||
description={meta_description}
|
||||
openGraph={{
|
||||
title: meta_title,
|
||||
description: meta_description,
|
||||
url: `https://supabase.com/${router.pathname}`,
|
||||
images: [
|
||||
{
|
||||
url: `https://supabase.com/images/og/supabase-og.png`,
|
||||
},
|
||||
],
|
||||
}}
|
||||
/>
|
||||
<Layout>
|
||||
<Container>
|
||||
<SectionContainer className="pb-0 md:pb-0 lg:pb-0">
|
||||
<h1 className="h1">Brand assets</h1>
|
||||
<p className="text-foreground text-xl">Download official Supabase logos</p>
|
||||
<div className="mt-2 sm:max-w-xl max-w-none">
|
||||
<p className="text-foreground-lighter text-sm">
|
||||
All Supabase trademarks, logos, or other brand elements can never be modified or
|
||||
used for any other purpose other than to represent Supabase Inc.
|
||||
</p>
|
||||
</div>
|
||||
</SectionContainer>
|
||||
<SectionContainer className="grid grid-cols-1 md:grid-cols-2 gap-5 lg:pt-12">
|
||||
<div className="shadow-small flex flex-col rounded-lg border border-default bg-surface-75 overflow-hidden">
|
||||
<div className="relative aspect-video w-full overflow-auto border-b">
|
||||
<Image
|
||||
src={supabaseLogoPreview}
|
||||
alt="Supabase logo Preview"
|
||||
layout="fill"
|
||||
objectFit="cover"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center p-5">
|
||||
<div className="gap-y-4 flex flex-col h-full justify-between">
|
||||
<div className="space-y-2">
|
||||
<h3 className="h3">Supabase logos</h3>
|
||||
<p className="text-foreground-lighter text-sm">
|
||||
Download Supabase official logos, including as SVG's, in both light and dark
|
||||
theme.
|
||||
</p>
|
||||
<p className="text-foreground-lighter text-sm">
|
||||
Do not use any other color for the wordmark.
|
||||
</p>
|
||||
</div>
|
||||
<form method="get" action={`/brand-assets.zip`} className="mt-3">
|
||||
<Button type="submit" iconRight={<Download />}>
|
||||
Download logo kit
|
||||
</Button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="shadow-small flex flex-col rounded-lg border border-default bg-surface-75 overflow-hidden">
|
||||
<div className="relative aspect-video w-full overflow-auto flex items-center justify-center border-b">
|
||||
<Image
|
||||
src="https://obuldanrptloktxcffvn.supabase.co/storage/v1/object/public/supabase-brand-assets/connect-supabase/connect-supabase-dark.svg"
|
||||
alt="Connect Supabase Button"
|
||||
width={154}
|
||||
height={31}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center p-5">
|
||||
<div className="gap-y-4 flex flex-col h-full justify-between">
|
||||
<div className="space-y-2">
|
||||
<h3 className="h3">Supabase Integrations</h3>
|
||||
<p className="text-foreground-lighter text-sm">
|
||||
When building a{' '}
|
||||
<a
|
||||
className="text-primary underline"
|
||||
href="/docs/guides/platform/oauth-apps/build-a-supabase-integration"
|
||||
>
|
||||
Supabase Integration
|
||||
</a>
|
||||
, use this "Connect Supabase" button to initiate the OAuth redirect.
|
||||
</p>
|
||||
<p className="text-foreground-lighter text-sm">
|
||||
Do not use any other color for the wordmark.
|
||||
</p>
|
||||
</div>
|
||||
<form
|
||||
method="get"
|
||||
action={`https://obuldanrptloktxcffvn.supabase.co/storage/v1/object/public/supabase-brand-assets/connect-supabase/connect-supabase.zip`}
|
||||
className="mt-3"
|
||||
>
|
||||
<Button type="submit" iconRight={<Download />}>
|
||||
Download button kit
|
||||
</Button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</SectionContainer>
|
||||
<CTABanner />
|
||||
</Container>
|
||||
</Layout>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default Index
|
||||
@@ -0,0 +1,158 @@
|
||||
import { VectorLogo } from '~/components/BrandAssets/VectorLogo'
|
||||
import { LogoGallery } from '~/components/BrandAssets/LogoGallery'
|
||||
import Layout from '~/components/Layouts/Default'
|
||||
import SectionContainer from '~/components/Layouts/SectionContainer'
|
||||
import { CircleCheckFilled, CrossfadeIcon } from '~/components/CrossfadeIcon'
|
||||
import Container from 'components/Container'
|
||||
import CTABanner from 'components/CTABanner/index'
|
||||
import { NextSeo } from 'next-seo'
|
||||
import type { InferGetStaticPropsType } from 'next'
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
import { useState } from 'react'
|
||||
import { Copy } from 'lucide-react'
|
||||
import { Button, copyToClipboard } from 'ui'
|
||||
|
||||
const Index = ({ guideText }: InferGetStaticPropsType<typeof getStaticProps>) => {
|
||||
const [isPromptCopied, setIsPromptCopied] = useState(false)
|
||||
const meta_title = 'Brand Guidelines: Logos and Icons | Supabase'
|
||||
const meta_description =
|
||||
'Official Supabase logos and colors, as SVG and PNG files for light and dark backgrounds'
|
||||
|
||||
const handlePromptCopy = () => {
|
||||
copyToClipboard(
|
||||
'Read https://supabase.com/brand.md and use the official Supabase logo file that fits the background where the logo will appear. Do not change the logo.',
|
||||
() => {
|
||||
setIsPromptCopied(true)
|
||||
setTimeout(() => setIsPromptCopied(false), 2000)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<NextSeo
|
||||
title={meta_title}
|
||||
description={meta_description}
|
||||
openGraph={{
|
||||
title: meta_title,
|
||||
description: meta_description,
|
||||
url: 'https://supabase.com/brand',
|
||||
images: [
|
||||
{
|
||||
url: `https://supabase.com/images/og/supabase-og.png`,
|
||||
},
|
||||
],
|
||||
}}
|
||||
/>
|
||||
<Layout>
|
||||
<Container>
|
||||
<section className="relative isolate overflow-clip">
|
||||
<SectionContainer className="flex flex-col items-center gap-4 pt-0 text-center sm:pt-0 md:pt-0">
|
||||
<VectorLogo guideText={guideText} className="pb-12" />
|
||||
<h1 className="m-0 text-5xl tracking-tight text-foreground sm:text-6xl">
|
||||
Brand Guidelines
|
||||
</h1>
|
||||
<p className="m-0 max-w-xl text-balance text-sm text-foreground-lighter">
|
||||
Official Supabase logos and colors, as SVG and PNG files for light and dark
|
||||
backgrounds{' '}
|
||||
<a
|
||||
href="#icon"
|
||||
className="hit-area-2 text-xs text-foreground-light underline underline-offset-4 transition-colors hover:text-foreground"
|
||||
>
|
||||
<span aria-hidden>⤵</span>
|
||||
<span className="sr-only">Go to the logo files</span>
|
||||
</a>
|
||||
</p>
|
||||
<div className="mt-2 flex flex-wrap justify-center gap-2">
|
||||
<Button asChild size="small">
|
||||
<a href="/brand-assets.zip" download>
|
||||
Download logo kit
|
||||
</a>
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
onClick={handlePromptCopy}
|
||||
icon={
|
||||
<CrossfadeIcon
|
||||
isActive={isPromptCopied}
|
||||
activeIcon={<CircleCheckFilled className="size-3.5" />}
|
||||
inactiveIcon={<Copy className="size-3.5" />}
|
||||
/>
|
||||
}
|
||||
>
|
||||
Copy agent prompt
|
||||
</Button>
|
||||
<span className="sr-only" role="status">
|
||||
{isPromptCopied ? 'Agent prompt copied' : ''}
|
||||
</span>
|
||||
</div>
|
||||
</SectionContainer>
|
||||
<div
|
||||
aria-hidden
|
||||
className="absolute inset-x-0 bottom-0 h-px bg-linear-to-r from-transparent via-border to-transparent"
|
||||
/>
|
||||
</section>
|
||||
<LogoGallery className="pb-0 md:pb-0" />
|
||||
<div className="section-container flex flex-col gap-20 pt-20 pb-16 md:pb-24">
|
||||
<section className="flex max-w-2xl flex-col gap-2">
|
||||
<h2 className="m-0 text-3xl tracking-tight text-foreground">Which file to use</h2>
|
||||
<ul className="m-0 flex list-disc flex-col gap-2 pl-5 text-pretty text-base text-foreground-light">
|
||||
<li>
|
||||
Choose the file for the background where the logo appears, not for your browser or
|
||||
editor theme.
|
||||
</li>
|
||||
<li>All files have a transparent background.</li>
|
||||
<li>
|
||||
There is no file with the lettering alone. Every wordmark file includes the
|
||||
symbol.
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section className="flex max-w-2xl flex-col gap-2">
|
||||
<h2 className="m-0 text-3xl tracking-tight text-foreground">Name</h2>
|
||||
<p className="m-0 text-pretty text-base text-foreground-light">
|
||||
Write Supabase as one word, with a capital S. Do not write SupaBase or Supa Base.
|
||||
</p>
|
||||
</section>
|
||||
<section className="flex max-w-2xl flex-col gap-2">
|
||||
<h2 className="m-0 text-3xl tracking-tight text-foreground">Usage</h2>
|
||||
<p className="m-0 text-pretty text-base text-foreground-light">
|
||||
Use the Supabase logos only to refer to Supabase. Do not change the files or the
|
||||
logo colors.
|
||||
</p>
|
||||
<p className="m-0 text-pretty text-base text-foreground-light">
|
||||
Supabase and the Supabase logo are trademarks of Supabase Inc.
|
||||
</p>
|
||||
</section>
|
||||
</div>
|
||||
<div
|
||||
aria-hidden
|
||||
className="h-px bg-linear-to-r from-transparent via-border to-transparent"
|
||||
/>
|
||||
<CTABanner className="border-t-0" />
|
||||
</Container>
|
||||
</Layout>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
// the hero guides are made of the team names, from the docs humans.txt
|
||||
export const getStaticProps = async () => {
|
||||
const humans = await readFile(
|
||||
path.join(process.cwd(), '..', 'docs', 'public', 'humans.txt'),
|
||||
'utf8'
|
||||
)
|
||||
const lines = humans.split('\n').map((line) => line.trim())
|
||||
// the names sit between the team intro sentence and the first rule
|
||||
const names = lines
|
||||
.slice(
|
||||
lines.indexOf('TEAM') + 1,
|
||||
lines.findIndex((line) => line.startsWith('_'))
|
||||
)
|
||||
.filter(Boolean)
|
||||
.slice(1)
|
||||
return { props: { guideText: `${names.join(' + ')} + `.toUpperCase() } }
|
||||
}
|
||||
|
||||
export default Index
|
||||
|
After Width: | Height: | Size: 48 KiB |
@@ -0,0 +1,15 @@
|
||||
<svg width="109" height="113" viewBox="0 0 109 113" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M63.7076 110.284C60.8481 113.885 55.0502 111.912 54.9813 107.314L53.9738 40.0627L99.1935 40.0627C107.384 40.0627 111.952 49.5228 106.859 55.9374L63.7076 110.284Z" fill="url(#paint0_linear)"/>
|
||||
<path d="M63.7076 110.284C60.8481 113.885 55.0502 111.912 54.9813 107.314L53.9738 40.0627L99.1935 40.0627C107.384 40.0627 111.952 49.5228 106.859 55.9374L63.7076 110.284Z" fill="url(#paint1_linear)" fill-opacity="0.2"/>
|
||||
<path d="M45.317 2.07103C48.1765 -1.53037 53.9745 0.442937 54.0434 5.041L54.4849 72.2922H9.83113C1.64038 72.2922 -2.92775 62.8321 2.1655 56.4175L45.317 2.07103Z" fill="#3ECF8E"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear" x1="53.9738" y1="54.974" x2="94.1635" y2="71.8295" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#249361"/>
|
||||
<stop offset="1" stop-color="#3ECF8E"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear" x1="36.1558" y1="30.578" x2="54.4844" y2="65.0806" gradientUnits="userSpaceOnUse">
|
||||
<stop/>
|
||||
<stop offset="1" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 21 KiB |
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 581 113">
|
||||
<!-- Generator: Adobe Illustrator 30.1.0, SVG Export Plug-In . SVG Version: 2.1.1 Build 136) -->
|
||||
<path d="M151.4,66.76c.6,5.6,5.69,15.2,20.48,15.2,12.89,0,19.08-8.2,19.08-16.2,0-7.2-4.9-13.1-14.59-15.1l-6.99-1.5c-2.7-.5-4.49-2-4.49-4.4,0-2.8,2.8-4.9,6.29-4.9,5.59,0,7.69,3.7,8.09,6.6l11.09-2.5c-.6-5.3-5.29-14.2-19.28-14.2-10.59,0-18.38,7.3-18.38,16.1,0,6.9,4.29,12.6,13.79,14.7l6.49,1.5c3.8.8,5.29,2.6,5.29,4.8,0,2.6-2.1,4.9-6.49,4.9-5.79,0-8.69-3.6-8.99-7.5l-11.39,2.5Z"/>
|
||||
<path d="M233.42,80.46h12.69c-.2-1.7-.5-5.1-.5-8.9V31.25h-13.29v28.61c0,5.7-3.4,9.7-9.29,9.7-6.19,0-8.99-4.4-8.99-9.9v-28.41h-13.29v31.11c0,10.7,6.79,19.4,18.68,19.4,5.19,0,10.89-2,13.59-6.6,0,2,.2,4.3.4,5.3Z"/>
|
||||
<path d="M273.08,99.47v-23.81c2.4,3.3,7.39,6,14.19,6,13.89,0,23.18-11,23.18-25.91s-8.29-25.61-22.68-25.61c-7.39,0-12.89,3.3-15.08,7.1v-6h-12.89v68.22h13.29ZM297.35,55.86c0,8.8-5.39,13.9-12.19,13.9s-12.29-5.2-12.29-13.9,5.49-13.8,12.29-13.8,12.19,5.1,12.19,13.8Z"/>
|
||||
<path d="M317.96,67.06c0,7.7,6.39,14.8,16.88,14.8,7.29,0,11.99-3.4,14.48-7.3,0,1.9.2,4.6.5,5.9h12.19c-.3-1.7-.6-5.2-.6-7.8v-24.21c0-9.9-5.79-18.7-21.38-18.7-13.19,0-20.28,8.5-21.08,16.2l11.79,2.5c.4-4.3,3.6-8,9.39-8s8.29,2.9,8.29,6.4c0,1.7-.9,3.1-3.7,3.5l-12.09,1.8c-8.19,1.2-14.69,6.1-14.69,14.9ZM337.64,71.96c-4.3,0-6.39-2.8-6.39-5.7,0-3.8,2.7-5.7,6.1-6.2l11.09-1.7v2.2c0,8.7-5.19,11.4-10.79,11.4Z"/>
|
||||
<path d="M387.7,80.46v-6c2.6,4.2,7.79,7.2,14.58,7.2,13.99,0,23.18-11.1,23.18-26.01s-8.29-25.71-22.68-25.71c-7.29,0-12.69,3.2-14.89,6.7V8.05h-13.09v72.42h12.89ZM412.18,55.76c0,9-5.39,14-12.19,14s-12.29-5.1-12.29-14,5.59-13.9,12.29-13.9,12.19,4.9,12.19,13.9Z"/>
|
||||
<path d="M432.99,67.06c0,7.7,6.39,14.8,16.88,14.8,7.29,0,11.99-3.4,14.49-7.3,0,1.9.2,4.6.5,5.9h12.19c-.3-1.7-.6-5.2-.6-7.8v-24.21c0-9.9-5.79-18.7-21.38-18.7-13.19,0-20.28,8.5-21.08,16.2l11.79,2.5c.4-4.3,3.6-8,9.39-8s8.29,2.9,8.29,6.4c0,1.7-.9,3.1-3.7,3.5l-12.09,1.8c-8.19,1.2-14.69,6.1-14.69,14.9ZM452.67,71.96c-4.3,0-6.39-2.8-6.39-5.7,0-3.8,2.7-5.7,6.1-6.2l11.09-1.7v2.2c0,8.7-5.19,11.4-10.79,11.4Z"/>
|
||||
<path d="M485.64,66.76c.6,5.6,5.69,15.2,20.48,15.2,12.89,0,19.08-8.2,19.08-16.2,0-7.2-4.89-13.1-14.59-15.1l-6.99-1.5c-2.7-.5-4.49-2-4.49-4.4,0-2.8,2.8-4.9,6.29-4.9,5.6,0,7.69,3.7,8.09,6.6l11.09-2.5c-.6-5.3-5.29-14.2-19.28-14.2-10.59,0-18.38,7.3-18.38,16.1,0,6.9,4.29,12.6,13.79,14.7l6.49,1.5c3.8.8,5.29,2.6,5.29,4.8,0,2.6-2.1,4.9-6.49,4.9-5.79,0-8.69-3.6-8.99-7.5l-11.39,2.5Z"/>
|
||||
<path d="M545.39,50.26c.3-4.5,4.1-9.7,10.99-9.7,7.59,0,10.79,4.8,10.99,9.7h-21.98ZM568.66,63.06c-1.6,4.4-5,7.5-11.19,7.5-6.59,0-12.09-4.7-12.39-11.2h35.17c0-.2.2-2.2.2-4.1,0-15.8-9.09-25.51-24.28-25.51-12.59,0-24.18,10.2-24.18,25.91,0,16.6,11.89,26.31,25.38,26.31,12.09,0,19.88-7.1,22.38-15.6l-11.09-3.3Z"/>
|
||||
<path d="M99.19,40.06h-44.92l-.23-35.02c-.07-4.6-5.87-6.57-8.73-2.97L2.17,56.42c-5.09,6.41-.53,15.87,7.67,15.87h44.63l.52,35.02c.07,4.6,5.87,6.57,8.73,2.97l43.15-54.35c5.09-6.41.53-15.87-7.67-15.87Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 81 KiB |
@@ -0,0 +1,23 @@
|
||||
<svg width="581" height="113" viewBox="0 0 581 113" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M151.397 66.7608C151.996 72.3621 157.091 81.9642 171.877 81.9642C184.764 81.9642 190.959 73.7624 190.959 65.7607C190.959 58.559 186.063 52.6577 176.373 50.6571L169.379 49.1569C166.682 48.6568 164.884 47.1565 164.884 44.7559C164.884 41.9552 167.681 39.8549 171.178 39.8549C176.772 39.8549 178.87 43.5556 179.27 46.4564L190.359 43.9558C189.76 38.6546 185.064 29.7527 171.078 29.7527C160.488 29.7527 152.696 37.0543 152.696 45.8561C152.696 52.7576 156.991 58.4591 166.482 60.5594L172.976 62.0598C176.772 62.8599 178.271 64.6605 178.271 66.8609C178.271 69.4615 176.173 71.762 171.777 71.762C165.983 71.762 163.085 68.1611 162.786 64.2602L151.397 66.7608Z" fill="#1F1F1F"/>
|
||||
<path d="M233.421 80.4639H246.109C245.909 78.7635 245.609 75.3628 245.609 71.5618V31.2529H232.321V59.8592C232.321 65.5606 228.925 69.5614 223.031 69.5614C216.837 69.5614 214.039 65.1604 214.039 59.6592V31.2529H200.752V62.3599C200.752 73.0622 207.545 81.7642 219.434 81.7642C224.628 81.7642 230.325 79.7638 233.022 75.1627C233.022 77.1631 233.221 79.4636 233.421 80.4639Z" fill="#1F1F1F"/>
|
||||
<path d="M273.076 99.4682V75.663C275.473 78.9636 280.469 81.6644 287.263 81.6644C301.149 81.6644 310.439 70.6617 310.439 55.7584C310.439 41.1553 302.148 30.1528 287.762 30.1528C280.37 30.1528 274.875 33.4534 272.677 37.2544V31.253H259.79V99.4682H273.076ZM297.352 55.8585C297.352 64.6606 291.958 69.7616 285.164 69.7616C278.372 69.7616 272.877 64.5605 272.877 55.8585C272.877 47.1566 278.372 42.0554 285.164 42.0554C291.958 42.0554 297.352 47.1566 297.352 55.8585Z" fill="#1F1F1F"/>
|
||||
<path d="M317.964 67.0609C317.964 74.7627 324.357 81.8643 334.848 81.8643C342.139 81.8643 346.835 78.4634 349.332 74.5625C349.332 76.463 349.532 79.1635 349.832 80.4639H362.02C361.72 78.7635 361.422 75.2627 361.422 72.6622V48.4567C361.422 38.5545 355.627 29.7527 340.043 29.7527C326.855 29.7527 319.761 38.2544 318.963 45.9562L330.751 48.4567C331.151 44.1558 334.348 40.455 340.141 40.455C345.737 40.455 348.434 43.3556 348.434 46.8564C348.434 48.5568 347.536 49.9572 344.738 50.3572L332.65 52.1576C324.458 53.3579 317.964 58.2589 317.964 67.0609ZM337.644 71.962C333.349 71.962 331.25 69.1614 331.25 66.2608C331.25 62.4599 333.947 60.5594 337.345 60.0594L348.434 58.359V60.5594C348.434 69.2615 343.239 71.962 337.644 71.962Z" fill="#1F1F1F"/>
|
||||
<path d="M387.703 80.4641V74.4627C390.299 78.6637 395.494 81.6644 402.288 81.6644C416.276 81.6644 425.467 70.5618 425.467 55.6585C425.467 41.0552 417.174 29.9528 402.788 29.9528C395.494 29.9528 390.1 33.1535 387.902 36.6541V8.04785H374.815V80.4641H387.703ZM412.178 55.7584C412.178 64.7605 406.784 69.7616 399.99 69.7616C393.297 69.7616 387.703 64.6606 387.703 55.7584C387.703 46.7564 393.297 41.8554 399.99 41.8554C406.784 41.8554 412.178 46.7564 412.178 55.7584Z" fill="#1F1F1F"/>
|
||||
<path d="M432.99 67.0609C432.99 74.7627 439.383 81.8643 449.873 81.8643C457.165 81.8643 461.862 78.4634 464.358 74.5625C464.358 76.463 464.559 79.1635 464.858 80.4639H477.046C476.748 78.7635 476.448 75.2627 476.448 72.6622V48.4567C476.448 38.5545 470.653 29.7527 455.068 29.7527C441.881 29.7527 434.788 38.2544 433.989 45.9562L445.776 48.4567C446.177 44.1558 449.374 40.455 455.167 40.455C460.763 40.455 463.46 43.3556 463.46 46.8564C463.46 48.5568 462.561 49.9572 459.763 50.3572L447.676 52.1576C439.484 53.3579 432.99 58.2589 432.99 67.0609ZM452.671 71.962C448.375 71.962 446.276 69.1614 446.276 66.2608C446.276 62.4599 448.973 60.5594 452.371 60.0594L463.46 58.359V60.5594C463.46 69.2615 458.265 71.962 452.671 71.962Z" fill="#1F1F1F"/>
|
||||
<path d="M485.645 66.7608C486.243 72.3621 491.339 81.9642 506.124 81.9642C519.012 81.9642 525.205 73.7624 525.205 65.7607C525.205 58.559 520.311 52.6577 510.62 50.6571L503.626 49.1569C500.929 48.6568 499.132 47.1565 499.132 44.7559C499.132 41.9552 501.928 39.8549 505.425 39.8549C511.021 39.8549 513.118 43.5556 513.519 46.4564L524.607 43.9558C524.007 38.6546 519.312 29.7527 505.326 29.7527C494.735 29.7527 486.944 37.0543 486.944 45.8561C486.944 52.7576 491.238 58.4591 500.73 60.5594L507.224 62.0598C511.021 62.8599 512.519 64.6605 512.519 66.8609C512.519 69.4615 510.421 71.762 506.025 71.762C500.23 71.762 497.334 68.1611 497.034 64.2602L485.645 66.7608Z" fill="#1F1F1F"/>
|
||||
<path d="M545.385 50.2571C545.685 45.7562 549.482 40.5549 556.375 40.5549C563.967 40.5549 567.165 45.3561 567.365 50.2571H545.385ZM568.664 63.0601C567.065 67.4609 563.668 70.5617 557.474 70.5617C550.88 70.5617 545.385 65.8606 545.087 59.3593H580.252C580.252 59.159 580.451 57.1587 580.451 55.2582C580.451 39.4547 571.361 29.7527 556.175 29.7527C543.588 29.7527 531.998 39.9548 531.998 55.6584C531.998 72.262 543.886 81.9642 557.374 81.9642C569.462 81.9642 577.255 74.8626 579.753 66.3607L568.664 63.0601Z" fill="#1F1F1F"/>
|
||||
<path d="M63.7076 110.284C60.8481 113.885 55.0502 111.912 54.9813 107.314L53.9738 40.0627L99.1935 40.0627C107.384 40.0627 111.952 49.5228 106.859 55.9374L63.7076 110.284Z" fill="url(#paint0_linear)"/>
|
||||
<path d="M63.7076 110.284C60.8481 113.885 55.0502 111.912 54.9813 107.314L53.9738 40.0627L99.1935 40.0627C107.384 40.0627 111.952 49.5228 106.859 55.9374L63.7076 110.284Z" fill="url(#paint1_linear)" fill-opacity="0.2"/>
|
||||
<path d="M45.317 2.07103C48.1765 -1.53037 53.9745 0.442937 54.0434 5.041L54.4849 72.2922H9.83113C1.64038 72.2922 -2.92775 62.8321 2.1655 56.4175L45.317 2.07103Z" fill="#3ECF8E"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear" x1="53.9738" y1="54.974" x2="94.1635" y2="71.8295" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#249361"/>
|
||||
<stop offset="1" stop-color="#3ECF8E"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear" x1="36.1558" y1="30.578" x2="54.4844" y2="65.0806" gradientUnits="userSpaceOnUse">
|
||||
<stop/>
|
||||
<stop offset="1" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 78 KiB |
@@ -0,0 +1,23 @@
|
||||
<svg width="581" height="113" viewBox="0 0 581 113" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M151.397 66.7608C151.996 72.3621 157.091 81.9642 171.877 81.9642C184.764 81.9642 190.959 73.7624 190.959 65.7607C190.959 58.559 186.063 52.6577 176.373 50.6571L169.379 49.1569C166.682 48.6568 164.884 47.1565 164.884 44.7559C164.884 41.9552 167.681 39.8549 171.178 39.8549C176.772 39.8549 178.87 43.5556 179.27 46.4564L190.359 43.9558C189.76 38.6546 185.064 29.7527 171.078 29.7527C160.488 29.7527 152.696 37.0543 152.696 45.8561C152.696 52.7576 156.991 58.4591 166.482 60.5594L172.976 62.0598C176.772 62.8599 178.271 64.6605 178.271 66.8609C178.271 69.4615 176.173 71.762 171.777 71.762C165.983 71.762 163.085 68.1611 162.786 64.2602L151.397 66.7608Z" fill="white"/>
|
||||
<path d="M233.421 80.4639H246.109C245.909 78.7635 245.609 75.3628 245.609 71.5618V31.2529H232.321V59.8592C232.321 65.5606 228.925 69.5614 223.031 69.5614C216.837 69.5614 214.039 65.1604 214.039 59.6592V31.2529H200.752V62.3599C200.752 73.0622 207.545 81.7642 219.434 81.7642C224.628 81.7642 230.325 79.7638 233.022 75.1627C233.022 77.1631 233.221 79.4636 233.421 80.4639Z" fill="white"/>
|
||||
<path d="M273.076 99.4682V75.663C275.473 78.9636 280.469 81.6644 287.263 81.6644C301.149 81.6644 310.439 70.6617 310.439 55.7584C310.439 41.1553 302.148 30.1528 287.762 30.1528C280.37 30.1528 274.875 33.4534 272.677 37.2544V31.253H259.79V99.4682H273.076ZM297.352 55.8585C297.352 64.6606 291.958 69.7616 285.164 69.7616C278.372 69.7616 272.877 64.5605 272.877 55.8585C272.877 47.1566 278.372 42.0554 285.164 42.0554C291.958 42.0554 297.352 47.1566 297.352 55.8585Z" fill="white"/>
|
||||
<path d="M317.964 67.0609C317.964 74.7627 324.357 81.8643 334.848 81.8643C342.139 81.8643 346.835 78.4634 349.332 74.5625C349.332 76.463 349.532 79.1635 349.832 80.4639H362.02C361.72 78.7635 361.422 75.2627 361.422 72.6622V48.4567C361.422 38.5545 355.627 29.7527 340.043 29.7527C326.855 29.7527 319.761 38.2544 318.963 45.9562L330.751 48.4567C331.151 44.1558 334.348 40.455 340.141 40.455C345.737 40.455 348.434 43.3556 348.434 46.8564C348.434 48.5568 347.536 49.9572 344.738 50.3572L332.65 52.1576C324.458 53.3579 317.964 58.2589 317.964 67.0609ZM337.644 71.962C333.349 71.962 331.25 69.1614 331.25 66.2608C331.25 62.4599 333.947 60.5594 337.345 60.0594L348.434 58.359V60.5594C348.434 69.2615 343.239 71.962 337.644 71.962Z" fill="white"/>
|
||||
<path d="M387.703 80.4641V74.4627C390.299 78.6637 395.494 81.6644 402.288 81.6644C416.276 81.6644 425.467 70.5618 425.467 55.6585C425.467 41.0552 417.174 29.9528 402.788 29.9528C395.494 29.9528 390.1 33.1535 387.902 36.6541V8.04785H374.815V80.4641H387.703ZM412.178 55.7584C412.178 64.7605 406.784 69.7616 399.99 69.7616C393.297 69.7616 387.703 64.6606 387.703 55.7584C387.703 46.7564 393.297 41.8554 399.99 41.8554C406.784 41.8554 412.178 46.7564 412.178 55.7584Z" fill="white"/>
|
||||
<path d="M432.99 67.0609C432.99 74.7627 439.383 81.8643 449.873 81.8643C457.165 81.8643 461.862 78.4634 464.358 74.5625C464.358 76.463 464.559 79.1635 464.858 80.4639H477.046C476.748 78.7635 476.448 75.2627 476.448 72.6622V48.4567C476.448 38.5545 470.653 29.7527 455.068 29.7527C441.881 29.7527 434.788 38.2544 433.989 45.9562L445.776 48.4567C446.177 44.1558 449.374 40.455 455.167 40.455C460.763 40.455 463.46 43.3556 463.46 46.8564C463.46 48.5568 462.561 49.9572 459.763 50.3572L447.676 52.1576C439.484 53.3579 432.99 58.2589 432.99 67.0609ZM452.671 71.962C448.375 71.962 446.276 69.1614 446.276 66.2608C446.276 62.4599 448.973 60.5594 452.371 60.0594L463.46 58.359V60.5594C463.46 69.2615 458.265 71.962 452.671 71.962Z" fill="white"/>
|
||||
<path d="M485.645 66.7608C486.243 72.3621 491.339 81.9642 506.124 81.9642C519.012 81.9642 525.205 73.7624 525.205 65.7607C525.205 58.559 520.311 52.6577 510.62 50.6571L503.626 49.1569C500.929 48.6568 499.132 47.1565 499.132 44.7559C499.132 41.9552 501.928 39.8549 505.425 39.8549C511.021 39.8549 513.118 43.5556 513.519 46.4564L524.607 43.9558C524.007 38.6546 519.312 29.7527 505.326 29.7527C494.735 29.7527 486.944 37.0543 486.944 45.8561C486.944 52.7576 491.238 58.4591 500.73 60.5594L507.224 62.0598C511.021 62.8599 512.519 64.6605 512.519 66.8609C512.519 69.4615 510.421 71.762 506.025 71.762C500.23 71.762 497.334 68.1611 497.034 64.2602L485.645 66.7608Z" fill="white"/>
|
||||
<path d="M545.385 50.2571C545.685 45.7562 549.482 40.5549 556.375 40.5549C563.967 40.5549 567.165 45.3561 567.365 50.2571H545.385ZM568.664 63.0601C567.065 67.4609 563.668 70.5617 557.474 70.5617C550.88 70.5617 545.385 65.8606 545.087 59.3593H580.252C580.252 59.159 580.451 57.1587 580.451 55.2582C580.451 39.4547 571.361 29.7527 556.175 29.7527C543.588 29.7527 531.998 39.9548 531.998 55.6584C531.998 72.262 543.886 81.9642 557.374 81.9642C569.462 81.9642 577.255 74.8626 579.753 66.3607L568.664 63.0601Z" fill="white"/>
|
||||
<path d="M63.7076 110.284C60.8481 113.885 55.0502 111.912 54.9813 107.314L53.9738 40.0627L99.1935 40.0627C107.384 40.0627 111.952 49.5228 106.859 55.9374L63.7076 110.284Z" fill="url(#paint0_linear)"/>
|
||||
<path d="M63.7076 110.284C60.8481 113.885 55.0502 111.912 54.9813 107.314L53.9738 40.0627L99.1935 40.0627C107.384 40.0627 111.952 49.5228 106.859 55.9374L63.7076 110.284Z" fill="url(#paint1_linear)" fill-opacity="0.2"/>
|
||||
<path d="M45.317 2.07103C48.1765 -1.53037 53.9745 0.442937 54.0434 5.041L54.4849 72.2922H9.83113C1.64038 72.2922 -2.92775 62.8321 2.1655 56.4175L45.317 2.07103Z" fill="#3ECF8E"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear" x1="53.9738" y1="54.974" x2="94.1635" y2="71.8295" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#249361"/>
|
||||
<stop offset="1" stop-color="#3ECF8E"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear" x1="36.1558" y1="30.578" x2="54.4844" y2="65.0806" gradientUnits="userSpaceOnUse">
|
||||
<stop/>
|
||||
<stop offset="1" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 24 KiB |
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 581 113">
|
||||
<!-- Generator: Adobe Illustrator 30.1.0, SVG Export Plug-In . SVG Version: 2.1.1 Build 136) -->
|
||||
<defs>
|
||||
<style>
|
||||
.st0 {
|
||||
fill: #fff;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<path class="st0" d="M151.4,66.76c.6,5.6,5.69,15.2,20.48,15.2,12.89,0,19.08-8.2,19.08-16.2,0-7.2-4.9-13.1-14.59-15.1l-6.99-1.5c-2.7-.5-4.49-2-4.49-4.4,0-2.8,2.8-4.9,6.29-4.9,5.59,0,7.69,3.7,8.09,6.6l11.09-2.5c-.6-5.3-5.29-14.2-19.28-14.2-10.59,0-18.38,7.3-18.38,16.1,0,6.9,4.29,12.6,13.79,14.7l6.49,1.5c3.8.8,5.29,2.6,5.29,4.8,0,2.6-2.1,4.9-6.49,4.9-5.79,0-8.69-3.6-8.99-7.5l-11.39,2.5Z"/>
|
||||
<path class="st0" d="M233.42,80.46h12.69c-.2-1.7-.5-5.1-.5-8.9V31.25h-13.29v28.61c0,5.7-3.4,9.7-9.29,9.7-6.19,0-8.99-4.4-8.99-9.9v-28.41h-13.29v31.11c0,10.7,6.79,19.4,18.68,19.4,5.19,0,10.89-2,13.59-6.6,0,2,.2,4.3.4,5.3Z"/>
|
||||
<path class="st0" d="M273.08,99.47v-23.81c2.4,3.3,7.39,6,14.19,6,13.89,0,23.18-11,23.18-25.91s-8.29-25.61-22.68-25.61c-7.39,0-12.89,3.3-15.08,7.1v-6h-12.89v68.22h13.29ZM297.35,55.86c0,8.8-5.39,13.9-12.19,13.9s-12.29-5.2-12.29-13.9,5.49-13.8,12.29-13.8,12.19,5.1,12.19,13.8Z"/>
|
||||
<path class="st0" d="M317.96,67.06c0,7.7,6.39,14.8,16.88,14.8,7.29,0,11.99-3.4,14.48-7.3,0,1.9.2,4.6.5,5.9h12.19c-.3-1.7-.6-5.2-.6-7.8v-24.21c0-9.9-5.79-18.7-21.38-18.7-13.19,0-20.28,8.5-21.08,16.2l11.79,2.5c.4-4.3,3.6-8,9.39-8s8.29,2.9,8.29,6.4c0,1.7-.9,3.1-3.7,3.5l-12.09,1.8c-8.19,1.2-14.69,6.1-14.69,14.9ZM337.64,71.96c-4.3,0-6.39-2.8-6.39-5.7,0-3.8,2.7-5.7,6.1-6.2l11.09-1.7v2.2c0,8.7-5.19,11.4-10.79,11.4Z"/>
|
||||
<path class="st0" d="M387.7,80.46v-6c2.6,4.2,7.79,7.2,14.58,7.2,13.99,0,23.18-11.1,23.18-26.01s-8.29-25.71-22.68-25.71c-7.29,0-12.69,3.2-14.89,6.7V8.05h-13.09v72.42h12.89ZM412.18,55.76c0,9-5.39,14-12.19,14s-12.29-5.1-12.29-14,5.59-13.9,12.29-13.9,12.19,4.9,12.19,13.9Z"/>
|
||||
<path class="st0" d="M432.99,67.06c0,7.7,6.39,14.8,16.88,14.8,7.29,0,11.99-3.4,14.49-7.3,0,1.9.2,4.6.5,5.9h12.19c-.3-1.7-.6-5.2-.6-7.8v-24.21c0-9.9-5.79-18.7-21.38-18.7-13.19,0-20.28,8.5-21.08,16.2l11.79,2.5c.4-4.3,3.6-8,9.39-8s8.29,2.9,8.29,6.4c0,1.7-.9,3.1-3.7,3.5l-12.09,1.8c-8.19,1.2-14.69,6.1-14.69,14.9ZM452.67,71.96c-4.3,0-6.39-2.8-6.39-5.7,0-3.8,2.7-5.7,6.1-6.2l11.09-1.7v2.2c0,8.7-5.19,11.4-10.79,11.4Z"/>
|
||||
<path class="st0" d="M485.64,66.76c.6,5.6,5.69,15.2,20.48,15.2,12.89,0,19.08-8.2,19.08-16.2,0-7.2-4.89-13.1-14.59-15.1l-6.99-1.5c-2.7-.5-4.49-2-4.49-4.4,0-2.8,2.8-4.9,6.29-4.9,5.6,0,7.69,3.7,8.09,6.6l11.09-2.5c-.6-5.3-5.29-14.2-19.28-14.2-10.59,0-18.38,7.3-18.38,16.1,0,6.9,4.29,12.6,13.79,14.7l6.49,1.5c3.8.8,5.29,2.6,5.29,4.8,0,2.6-2.1,4.9-6.49,4.9-5.79,0-8.69-3.6-8.99-7.5l-11.39,2.5Z"/>
|
||||
<path class="st0" d="M545.39,50.26c.3-4.5,4.1-9.7,10.99-9.7,7.59,0,10.79,4.8,10.99,9.7h-21.98ZM568.66,63.06c-1.6,4.4-5,7.5-11.19,7.5-6.59,0-12.09-4.7-12.39-11.2h35.17c0-.2.2-2.2.2-4.1,0-15.8-9.09-25.51-24.28-25.51-12.59,0-24.18,10.2-24.18,25.91,0,16.6,11.89,26.31,25.38,26.31,12.09,0,19.88-7.1,22.38-15.6l-11.09-3.3Z"/>
|
||||
<path class="st0" d="M99.19,40.06h-44.92l-.23-35.02c-.07-4.6-5.87-6.57-8.73-2.97L2.17,56.42c-5.09,6.41-.53,15.87,7.67,15.87h44.63l.52,35.02c.07,4.6,5.87,6.57,8.73,2.97l43.15-54.35c5.09-6.41.53-15.87-7.67-15.87Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.2 KiB |
@@ -1,5 +1,7 @@
|
||||
@import 'config/tailwind.config.css';
|
||||
@import 'config/inline-code.css';
|
||||
@import 'ui-patterns/CodeBlock/code-block.css';
|
||||
@import 'ui-patterns/Notch/notch.css';
|
||||
|
||||
@source '../_blog/*.mdx';
|
||||
@source '../components/**/*.tsx';
|
||||
@@ -17,12 +19,21 @@
|
||||
var(--font-inter), Inter, Helvetica Neue, Helvetica, ui-sans-serif, system-ui, sans-serif;
|
||||
--font-heading: var(--font-manrope, var(--font-sans));
|
||||
--font-mono: var(--font-source-code-pro), 'Source Code Pro', ui-monospace, Menlo, monospace;
|
||||
|
||||
--color-pane-dark: hsl(var(--colors-gray-dark-300));
|
||||
}
|
||||
|
||||
@utility section-container {
|
||||
@apply w-full mx-auto max-w-7xl px-6 lg:px-12 xl:px-24;
|
||||
}
|
||||
|
||||
@utility construction-mask {
|
||||
mask:
|
||||
linear-gradient(to right, transparent, #000 35%, #000 65%, transparent),
|
||||
linear-gradient(to bottom, #000 60%, transparent);
|
||||
mask-composite: intersect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Legal documents must paint the exact characters that are in their source text.
|
||||
*
|
||||
@@ -75,6 +86,8 @@
|
||||
--animate-marquee-vertical: marquee-vertical 180s linear infinite both;
|
||||
--animate-pulse-radar: pulse-radar 3s linear infinite;
|
||||
--animate-slide-in: slideIn 250ms ease-in both;
|
||||
--animate-draw-line: draw-line 1.8s linear both;
|
||||
--animate-reveal-hatch: reveal-hatch 2.4s cubic-bezier(0.4, 0, 1, 1) 1.8s both;
|
||||
|
||||
--delay-1200: 1200ms;
|
||||
--delay-1500: 1500ms;
|
||||
@@ -94,6 +107,21 @@
|
||||
--font-weight-normal: 450;
|
||||
}
|
||||
|
||||
@keyframes draw-line {
|
||||
from {
|
||||
stroke-dashoffset: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes reveal-hatch {
|
||||
from {
|
||||
scale: 0;
|
||||
}
|
||||
to {
|
||||
scale: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes flash-code {
|
||||
0% {
|
||||
background-color: rgba(63, 207, 142, 0.1);
|
||||
|
||||
@@ -67,6 +67,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
@utility raised-svg-surface {
|
||||
& stop:first-child {
|
||||
stop-color: hsl(var(--colors-white) / 0.015);
|
||||
}
|
||||
& stop:last-child {
|
||||
stop-color: hsl(var(--colors-black) / 0.01);
|
||||
}
|
||||
& feDropShadow {
|
||||
flood-color: hsl(var(--colors-black) / var(--button-shadow-opacity));
|
||||
}
|
||||
& [data-raised-edge] {
|
||||
stroke: hsl(var(--button-edge-color) / calc(0.1 * var(--button-edge-strength)));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Soft shimmer gradient used by LoadingLine.
|
||||
*/
|
||||
|
||||
@@ -77,7 +77,8 @@ module.exports = defineConfig([
|
||||
},
|
||||
rules: {
|
||||
'shadcn/no-unknown-classes': ['warn', { allow: ['not-prose'] }],
|
||||
'shadcn/no-arbitrary-values': ['warn', { allow: ['layout'] }],
|
||||
// a transition-[...] list names css properties, not a design value, so no token can replace it
|
||||
'shadcn/no-arbitrary-values': ['warn', { allow: ['layout', 'transition'] }],
|
||||
'shadcn/no-raw-colors': 'warn',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -435,6 +435,10 @@
|
||||
"import": "./src/GlassPanel/index.tsx",
|
||||
"types": "./src/GlassPanel/index.tsx"
|
||||
},
|
||||
"./GlyphLines": {
|
||||
"import": "./src/GlyphLines/index.tsx",
|
||||
"types": "./src/GlyphLines/index.tsx"
|
||||
},
|
||||
"./Image/Image": {
|
||||
"import": "./src/Image/Image.tsx",
|
||||
"types": "./src/Image/Image.tsx"
|
||||
@@ -575,10 +579,19 @@
|
||||
"import": "./src/MultipleCodeBlock/index.tsx",
|
||||
"types": "./src/MultipleCodeBlock/index.tsx"
|
||||
},
|
||||
"./Notch/NotchOutline": {
|
||||
"import": "./src/Notch/NotchOutline.tsx",
|
||||
"types": "./src/Notch/NotchOutline.tsx"
|
||||
},
|
||||
"./Notch": {
|
||||
"import": "./src/Notch/index.ts",
|
||||
"types": "./src/Notch/index.ts"
|
||||
},
|
||||
"./Notch/notch.css": {
|
||||
"style": "./src/Notch/notch.css",
|
||||
"import": "./src/Notch/notch.css",
|
||||
"types": "./src/Notch/notch.css"
|
||||
},
|
||||
"./PageBreadcrumbs": {
|
||||
"import": "./src/PageBreadcrumbs/index.tsx",
|
||||
"types": "./src/PageBreadcrumbs/index.tsx"
|
||||
|
||||
@@ -69,8 +69,14 @@ export function CodeCopyButton({
|
||||
)
|
||||
}
|
||||
|
||||
export function CodeBlockControls({ content }: { content: string }) {
|
||||
const [isWrapped, setIsWrapped] = useState(false)
|
||||
export function CodeBlockControls({
|
||||
content,
|
||||
defaultWrapped = false,
|
||||
}: {
|
||||
content: string
|
||||
defaultWrapped?: boolean
|
||||
}) {
|
||||
const [isWrapped, setIsWrapped] = useState(defaultWrapped)
|
||||
// Empty until the first toggle, so nothing is announced on mount
|
||||
const [wrapStatus, setWrapStatus] = useState('')
|
||||
|
||||
|
||||
@@ -0,0 +1,304 @@
|
||||
import { useCallback, type RefObject } from 'react'
|
||||
import { cn } from 'ui'
|
||||
|
||||
export interface GlyphLinesProps {
|
||||
linesRef: RefObject<SVGSVGElement | null>
|
||||
text: string
|
||||
className?: string
|
||||
}
|
||||
|
||||
interface Pulse {
|
||||
line: SVGLineElement
|
||||
head: number
|
||||
end: number
|
||||
speed: number
|
||||
}
|
||||
|
||||
interface GlyphLine {
|
||||
line: SVGLineElement
|
||||
start: Point
|
||||
direction: Point
|
||||
from: number
|
||||
to: number
|
||||
step: number
|
||||
textOffset: number
|
||||
}
|
||||
|
||||
type Point = [number, number]
|
||||
|
||||
// in css px. glyphs this small read as a line at 100%, and as text once the page is zoomed in
|
||||
const GLYPH_SIZE = 2.2
|
||||
const PULSE_LENGTH = 140
|
||||
// px past the canvas edge where glyphs still draw, so a glyph does not pop in at the edge
|
||||
const EDGE = 24
|
||||
|
||||
const opaqueColors = new Map<string, string>()
|
||||
|
||||
// border tokens have alpha, and alpha adds up where glyphs overlap. so glyphs draw in the opaque color the token gives over the surface
|
||||
export const toOpaque = (color: string, surface: string): string => {
|
||||
if (color === surface) return color
|
||||
const key = `${color}|${surface}`
|
||||
const cached = opaqueColors.get(key)
|
||||
if (cached) return cached
|
||||
const probe = document.createElement('canvas').getContext('2d', { willReadFrequently: true })
|
||||
if (!probe) return color
|
||||
probe.canvas.width = 1
|
||||
probe.canvas.height = 1
|
||||
probe.fillStyle = surface
|
||||
probe.fillRect(0, 0, 1, 1)
|
||||
probe.fillStyle = color
|
||||
probe.fillRect(0, 0, 1, 1)
|
||||
const [red, green, blue] = probe.getImageData(0, 0, 1, 1).data
|
||||
const opaque = `rgb(${red} ${green} ${blue})`
|
||||
opaqueColors.set(key, opaque)
|
||||
return opaque
|
||||
}
|
||||
|
||||
const startGlyphLines = ({
|
||||
canvas,
|
||||
linesRef,
|
||||
text,
|
||||
}: {
|
||||
canvas: HTMLCanvasElement
|
||||
linesRef: RefObject<SVGSVGElement | null>
|
||||
text: string
|
||||
}) => {
|
||||
const context = canvas.getContext('2d')
|
||||
// the glyphs at rest draw once into this layer, and only again when the lines move or the zoom changes
|
||||
const layer = document.createElement('canvas')
|
||||
const layerContext = layer.getContext('2d')
|
||||
if (!context || !layerContext || !text) return
|
||||
const isReducedMotion = matchMedia('(prefers-reduced-motion: reduce)').matches
|
||||
let pulses: Pulse[] = []
|
||||
let layerKey = ''
|
||||
let last = performance.now()
|
||||
let frame = 0
|
||||
|
||||
const draw = (now: number) => {
|
||||
frame = requestAnimationFrame(draw)
|
||||
const elapsed = Math.min(now - last, 100)
|
||||
last = now
|
||||
const svg = linesRef.current
|
||||
const box = canvas.getBoundingClientRect()
|
||||
if (!svg || !box.width || box.bottom < 0 || box.top > innerHeight) return
|
||||
// the svg can start its draw-in from this attribute. the next frame reads the first animated dash
|
||||
if (!svg.hasAttribute('data-glyph-lines-ready')) {
|
||||
svg.setAttribute('data-glyph-lines-ready', '')
|
||||
return
|
||||
}
|
||||
|
||||
// browser zoom changes the device pixel ratio, and a pinch zoom changes the visual viewport scale
|
||||
const ratio = Math.min(
|
||||
devicePixelRatio * (visualViewport?.scale ?? 1),
|
||||
// safari blanks a canvas past about 16M px, so a deep pinch zoom caps the resolution
|
||||
Math.sqrt(16_000_000 / (box.width * box.height))
|
||||
)
|
||||
const width = Math.round(box.width * ratio)
|
||||
const height = Math.round(box.height * ratio)
|
||||
const style = getComputedStyle(canvas)
|
||||
const font = `${GLYPH_SIZE}px ${style.fontFamily}`
|
||||
const svgBox = svg.getBoundingClientRect()
|
||||
const lines = [...svg.querySelectorAll<SVGLineElement>('line[data-glyph-line]')]
|
||||
const origin: Point = [svgBox.left - box.left, svgBox.top - box.top]
|
||||
const glyphLines = lines.flatMap((line, lineIndex) =>
|
||||
toGlyphLine({ line, lineIndex, origin, size: [box.width, box.height] })
|
||||
)
|
||||
const toScreen = ({ start, direction }: GlyphLine, distance: number): Point => [
|
||||
start[0] + direction[0] * distance,
|
||||
start[1] + direction[1] * distance,
|
||||
]
|
||||
|
||||
if (canvas.width !== width || canvas.height !== height) {
|
||||
canvas.width = width
|
||||
canvas.height = height
|
||||
}
|
||||
// a theme change swaps the color, so it is part of the key too
|
||||
const key = [
|
||||
style.color,
|
||||
style.caretColor,
|
||||
font,
|
||||
// the glyphs draw in a fallback font until the web font loads
|
||||
document.fonts.status,
|
||||
...[
|
||||
width,
|
||||
height,
|
||||
...glyphLines.flatMap((glyphLine) => [...glyphLine.start, glyphLine.from, glyphLine.to]),
|
||||
].map((value) => value.toFixed(2)),
|
||||
].join()
|
||||
|
||||
if (key !== layerKey) {
|
||||
layerKey = key
|
||||
layer.width = width
|
||||
layer.height = height
|
||||
layerContext.setTransform(ratio, 0, 0, ratio, 0, 0)
|
||||
const color = toOpaque(style.color, style.caretColor)
|
||||
layerContext.font = font
|
||||
layerContext.textAlign = 'center'
|
||||
layerContext.textBaseline = 'middle'
|
||||
glyphLines.forEach((glyphLine) => {
|
||||
const indexes: number[] = []
|
||||
for (
|
||||
let index = Math.ceil(glyphLine.from / glyphLine.step);
|
||||
index * glyphLine.step <= glyphLine.to;
|
||||
index++
|
||||
) {
|
||||
indexes.push(index)
|
||||
}
|
||||
// each glyph cell fills with the caret color first, so a line hides the glyphs of a line it crosses.
|
||||
// without a caret color, the caret color is the text color, and the cells would hide the glyphs
|
||||
if (color !== style.caretColor) {
|
||||
layerContext.beginPath()
|
||||
for (const index of indexes) {
|
||||
const [x, y] = toScreen(glyphLine, index * glyphLine.step)
|
||||
layerContext.rect(
|
||||
x - GLYPH_SIZE * 0.325,
|
||||
y - GLYPH_SIZE * 0.5,
|
||||
GLYPH_SIZE * 0.65,
|
||||
GLYPH_SIZE
|
||||
)
|
||||
}
|
||||
layerContext.fillStyle = style.caretColor
|
||||
layerContext.fill()
|
||||
}
|
||||
layerContext.fillStyle = color
|
||||
for (const index of indexes) {
|
||||
const char = text[(index + glyphLine.textOffset) % text.length]
|
||||
if (char === ' ') continue
|
||||
layerContext.fillText(char, ...toScreen(glyphLine, index * glyphLine.step))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
context.setTransform(1, 0, 0, 1, 0, 0)
|
||||
context.clearRect(0, 0, width, height)
|
||||
context.drawImage(layer, 0, 0)
|
||||
|
||||
pulses = pulses
|
||||
.map((pulse) => ({ ...pulse, head: pulse.head + pulse.speed * elapsed }))
|
||||
.filter((pulse) => (pulse.end - pulse.head) * Math.sign(pulse.speed) > 0)
|
||||
context.setTransform(ratio, 0, 0, ratio, 0, 0)
|
||||
const pulseColor = toOpaque(
|
||||
style.getPropertyValue('--glyph-lines-pulse') || style.color,
|
||||
style.caretColor
|
||||
)
|
||||
context.fillStyle = pulseColor
|
||||
context.shadowColor = pulseColor
|
||||
context.shadowBlur = 4
|
||||
context.font = font
|
||||
context.textAlign = 'center'
|
||||
context.textBaseline = 'middle'
|
||||
pulses.forEach((pulse) => {
|
||||
const glyphLine = glyphLines.find(({ line }) => line === pulse.line)
|
||||
if (!glyphLine) return
|
||||
const tail = pulse.head - Math.sign(pulse.speed) * PULSE_LENGTH
|
||||
const from = Math.max(Math.min(pulse.head, tail), glyphLine.from)
|
||||
const to = Math.min(Math.max(pulse.head, tail), glyphLine.to)
|
||||
for (let index = Math.ceil(from / glyphLine.step); index * glyphLine.step <= to; index++) {
|
||||
const char = text[(index + glyphLine.textOffset) % text.length]
|
||||
if (char === ' ') continue
|
||||
const behind = Math.abs(pulse.head - index * glyphLine.step)
|
||||
context.globalAlpha = 1 - behind / PULSE_LENGTH
|
||||
context.fillText(char, ...toScreen(glyphLine, index * glyphLine.step))
|
||||
}
|
||||
})
|
||||
context.globalAlpha = 1
|
||||
context.shadowBlur = 0
|
||||
|
||||
if (isReducedMotion || pulses.length >= 3 || !glyphLines.length) return
|
||||
// a new pulse starts about every 1800ms
|
||||
if (Math.random() > elapsed / 1800) return
|
||||
const glyphLine = glyphLines[Math.floor(Math.random() * glyphLines.length)]
|
||||
const isForward = Math.random() < 0.5
|
||||
pulses.push({
|
||||
line: glyphLine.line,
|
||||
speed: (0.25 + Math.random() * 0.35) * (isForward ? 1 : -1),
|
||||
head: isForward ? glyphLine.from : glyphLine.to,
|
||||
end: isForward ? glyphLine.to + PULSE_LENGTH : glyphLine.from - PULSE_LENGTH,
|
||||
})
|
||||
}
|
||||
|
||||
frame = requestAnimationFrame(draw)
|
||||
return () => cancelAnimationFrame(frame)
|
||||
}
|
||||
|
||||
const toGlyphLine = ({
|
||||
line,
|
||||
lineIndex,
|
||||
origin,
|
||||
size,
|
||||
}: {
|
||||
line: SVGLineElement
|
||||
lineIndex: number
|
||||
origin: Point
|
||||
size: Point
|
||||
}): GlyphLine[] => {
|
||||
// the dash runs from 1 (hidden) to 0 (drawn) along a pathLength of 1
|
||||
const drawn =
|
||||
1 - Math.min(Math.max(parseFloat(getComputedStyle(line).strokeDashoffset) || 0, 0), 1)
|
||||
if (!drawn) return []
|
||||
// the line's own ctm holds the transforms of its parent groups
|
||||
const matrix = line.getCTM()
|
||||
const toCanvas = (x: number, y: number): Point => {
|
||||
const point = new DOMPoint(x, y).matrixTransform(matrix ?? undefined)
|
||||
return [origin[0] + point.x, origin[1] + point.y]
|
||||
}
|
||||
const start = toCanvas(line.x1.baseVal.value, line.y1.baseVal.value)
|
||||
const end = toCanvas(line.x2.baseVal.value, line.y2.baseVal.value)
|
||||
const length = Math.hypot(end[0] - start[0], end[1] - start[1])
|
||||
const range = clipToBox({ from: start, to: end, size })
|
||||
if (!length || !range) return []
|
||||
const direction: Point = [(end[0] - start[0]) / length, (end[1] - start[1]) / length]
|
||||
return [
|
||||
{
|
||||
line,
|
||||
start,
|
||||
direction,
|
||||
from: range[0] * length,
|
||||
to: Math.min(range[1], drawn) * length,
|
||||
// an upright glyph box is 0.65 wide and 1 tall, so the step is the box size along the line.
|
||||
// rows and columns keep their spacing, and diagonal glyphs do not overlap
|
||||
step: GLYPH_SIZE * (Math.abs(direction[0]) * 0.65 + Math.abs(direction[1])),
|
||||
// each line starts at a different place in the text, so neighbor lines do not repeat
|
||||
textOffset: lineIndex * 1009,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
// the part of the segment inside the box, as fractions of the segment
|
||||
const clipToBox = ({ from, to, size }: { from: Point; to: Point; size: Point }): Point | null => {
|
||||
const delta = [to[0] - from[0], to[1] - from[1]]
|
||||
const checks = [
|
||||
[-delta[0], from[0] + EDGE],
|
||||
[delta[0], size[0] + EDGE - from[0]],
|
||||
[-delta[1], from[1] + EDGE],
|
||||
[delta[1], size[1] + EDGE - from[1]],
|
||||
]
|
||||
return checks.reduce<Point | null>(
|
||||
(current, [p, q]) => {
|
||||
if (!current) return null
|
||||
if (p === 0) return q < 0 ? null : current
|
||||
const fraction = q / p
|
||||
const next: Point =
|
||||
p < 0
|
||||
? [Math.max(current[0], fraction), current[1]]
|
||||
: [current[0], Math.min(current[1], fraction)]
|
||||
return next[0] > next[1] ? null : next
|
||||
},
|
||||
[0, 1]
|
||||
)
|
||||
}
|
||||
|
||||
export const GlyphLines = ({ linesRef, text, className }: GlyphLinesProps) => {
|
||||
// the loop reads the lines from the dom on every frame, so a change to the lines does not restart it
|
||||
const handleCanvasRef = useCallback(
|
||||
(canvas: HTMLCanvasElement | null) => {
|
||||
if (!canvas) return
|
||||
return startGlyphLines({ canvas, linesRef, text })
|
||||
},
|
||||
[linesRef, text]
|
||||
)
|
||||
|
||||
return (
|
||||
<canvas ref={handleCanvasRef} aria-hidden className={cn('pointer-events-none', className)} />
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import type { ReactNode } from 'react'
|
||||
import { cn } from 'ui'
|
||||
|
||||
import { getNotchOutline } from './index'
|
||||
|
||||
export interface NotchOutlineProps {
|
||||
width: number
|
||||
surfaceClassName: string
|
||||
className?: string
|
||||
children?: ReactNode
|
||||
}
|
||||
|
||||
export const NotchOutline = ({
|
||||
width,
|
||||
surfaceClassName,
|
||||
className,
|
||||
children,
|
||||
}: NotchOutlineProps) => {
|
||||
const outline = getNotchOutline(width)
|
||||
|
||||
return (
|
||||
<svg
|
||||
aria-hidden
|
||||
width={width + 8}
|
||||
height="40"
|
||||
viewBox={`0 0 ${width + 8} 40`}
|
||||
fill="none"
|
||||
className={cn('pointer-events-none absolute right-0 bottom-0 overflow-visible', className)}
|
||||
>
|
||||
<path d={outline} className={surfaceClassName} />
|
||||
<path d={outline} className="stroke-border" />
|
||||
{children}
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
@@ -1,10 +1,20 @@
|
||||
import type { CSSProperties } from 'react'
|
||||
|
||||
type NotchStyle = CSSProperties & { '--notch-width': string; '--notch-mask': string }
|
||||
|
||||
export const getNotchOutline = (width: number): string =>
|
||||
`M0 39.5A7.5 7.5 0 0 0 7.5 32V16A8.5 8.5 0 0 1 16 7.5H${width}A7.5 7.5 0 0 0 ${width + 7.5} 0`
|
||||
|
||||
export const getNotchFocusRing = (width: number): string =>
|
||||
`M0 41A9 9 0 0 0 9 32V16A7 7 0 0 1 16 9H${width}A9 9 0 0 0 ${width + 9} 0`
|
||||
|
||||
export const getNotchMask = (width: number): string =>
|
||||
const getNotchMask = (width: number): string =>
|
||||
`url("data:image/svg+xml,${encodeURIComponent(
|
||||
`<svg xmlns='http://www.w3.org/2000/svg' width='${width + 10}' height='42'><path d='M0 40A8 8 0 0 0 8 32V16A8 8 0 0 1 16 8H${width}A8 8 0 0 0 ${width + 8} 0H${width + 10}V42H0Z'/></svg>`
|
||||
)}")`
|
||||
|
||||
// the css variables that the notch-corner utility in ./notch.css reads
|
||||
export const getNotchStyle = (width: number): NotchStyle => ({
|
||||
'--notch-width': `${width}px`,
|
||||
'--notch-mask': getNotchMask(width),
|
||||
})
|
||||
@@ -0,0 +1,7 @@
|
||||
@utility notch-corner {
|
||||
mask:
|
||||
linear-gradient(#000 0 0),
|
||||
var(--notch-mask) right -2px bottom -2px / calc(var(--notch-width) + 10px) 42px no-repeat;
|
||||
mask-composite: exclude;
|
||||
mask-clip: no-clip;
|
||||
}
|
||||