mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Feature — the visual redesign itself. Part 5 of 6 in a stack that splits the library redesign into reviewable pieces. The four PRs beneath it carry the build, content and Markdown work; what's left here is layout, navigation and styling. ## What is the current behavior? The library is laid out like a documentation site: a sidebar tree of framework folders, a homepage that lists links, and a guide page that opens with prose. That shape suits reference material, but the library's job is to help someone find a block and install it — and the sidebar is the only way to discover one. ## What is the new behavior? The homepage is the catalog itself — blocks grouped by what they do (authentication, database, storage, realtime, messaging, AI, foundations) rather than by framework, each with a preview of what it renders, filterable by category. Navigation moves into a site header whose Explore menu opens the same categories, so the catalog is reachable from any page and the per-page sidebar tree is gone. A guide opens with what the reader came for: the block's name, the install command, and a preview pane with tabs — the running component and its files — before any prose. The file tree that used to sit mid-page under "Folder structure" is one of those tabs. Every guide also offers a copy of the agent prompt that points at its Markdown. Getting-started pages get the same treatment: the quickstart is now a framework-tabbed walkthrough rather than a wall of setup links. ## Additional context `BlockOverviewTabs` renders Preview and Files here. #50369, stacked on top of this one, adds the third "What's added" tab — it is the only part of the redesign that depends on the new resource analyzer, which is why it sits above this PR rather than below it. Also removes what the redesign orphaned: the table-of-contents component and its `remark` / `mdast-util-toc` dependencies, and the sidebar nav and command-item configuration the new header replaced. The block source changes are typography only — auth card titles move from `text-2xl` to `font-medium text-lg tracking-normal` — which is what regenerates the auth registry artifacts. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a redesigned Supabase Library catalog with categorized blocks, framework-aware navigation, previews, file views, and installation actions. * Added framework-specific quickstart guides for Next.js, React, Vue, Nuxt, React Router, and TanStack Start. * Added copy-to-clipboard prompts, “Open in v0” actions, starter templates, and richer visual previews. * **Improvements** * Updated documentation layouts, FAQ content, typography, navigation, accessibility, and responsive behavior. * Improved mobile navigation, framework selection, and standardized block installation guidance. * Refined authentication and social-login block presentation with more consistent heading styles. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Danny White <3104761+dnywh@users.noreply.github.com>
173 lines
7.0 KiB
TypeScript
173 lines
7.0 KiB
TypeScript
'use client'
|
|
|
|
import { ArrowUpRight, Box } from 'lucide-react'
|
|
import Link from 'next/link'
|
|
import { useRouter, useSearchParams } from 'next/navigation'
|
|
import { Button, cn } from 'ui'
|
|
|
|
import { CatalogPreview } from '@/components/catalog-preview'
|
|
import {
|
|
getLibraryBlockHref,
|
|
libraryBlocks,
|
|
libraryCategories,
|
|
type LibraryBlock,
|
|
} from '@/config/library'
|
|
import { useFramework } from '@/context/framework-context'
|
|
|
|
function LibraryCard({ block, framework }: { block: LibraryBlock; framework: string }) {
|
|
return (
|
|
<Link
|
|
href={getLibraryBlockHref(block, framework)}
|
|
className="group flex w-full min-w-0 flex-col gap-4 rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand sm:w-[calc((100%-1.5rem)/2)] lg:w-[calc((100%-3rem)/3)] xl:w-[calc((100%-4.5rem)/4)]"
|
|
>
|
|
<div className="aspect-[4/3] overflow-hidden rounded-md border bg-surface-75 bg-[radial-gradient(var(--color-border)_1px,transparent_1px)] [background-size:20px_20px] transition-colors group-hover:border-stronger group-focus-visible:border-stronger">
|
|
<div className="h-full w-full grayscale transition-[filter] duration-200 group-hover:grayscale-0 group-focus-visible:grayscale-0 motion-reduce:transition-none">
|
|
<CatalogPreview kind={block.preview} />
|
|
</div>
|
|
</div>
|
|
<div className="flex flex-col gap-2 px-1 pb-2">
|
|
<div className="flex items-start justify-between gap-3">
|
|
<h3 className="min-w-0 text-sm font-medium tracking-tight">{block.title}</h3>
|
|
<span className="flex shrink-0 items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] leading-3 text-foreground-light">
|
|
<Box aria-hidden="true" className="size-2.5" />
|
|
{block.category === 'Starter apps' ? 'Starter' : 'Block'}
|
|
</span>
|
|
</div>
|
|
<p className="max-w-sm text-sm leading-5 text-foreground-lighter">{block.description}</p>
|
|
{block.external && (
|
|
<span className="flex items-center gap-1 text-xs text-foreground-lighter">
|
|
View starter on GitHub
|
|
<ArrowUpRight aria-hidden="true" className="size-3" />
|
|
</span>
|
|
)}
|
|
</div>
|
|
</Link>
|
|
)
|
|
}
|
|
|
|
export function LibraryOverview() {
|
|
const router = useRouter()
|
|
const searchParams = useSearchParams()
|
|
const selectedCategory = searchParams.get('category')
|
|
const activeCategory =
|
|
libraryCategories.find((category) => category.name === selectedCategory)?.name ?? 'All'
|
|
const { framework } = useFramework()
|
|
|
|
const filtered = libraryBlocks.filter(
|
|
(block) => activeCategory === 'All' || block.category === activeCategory
|
|
)
|
|
const sections = libraryCategories
|
|
.map((category) => ({
|
|
...category,
|
|
items: filtered.filter((block) => block.category === category.name),
|
|
}))
|
|
.filter((section) => section.items.length > 0)
|
|
|
|
function selectCategory(category: string) {
|
|
const params = new URLSearchParams(searchParams.toString())
|
|
if (category === 'All') params.delete('category')
|
|
else params.set('category', category)
|
|
router.replace(params.size ? `/?${params}` : '/', { scroll: false })
|
|
}
|
|
|
|
return (
|
|
<main>
|
|
<section className="mx-auto flex max-w-7xl flex-col gap-6 px-4 pb-10 pt-16 md:px-8 md:pb-12 md:pt-24">
|
|
<h1 className="max-w-2xl text-balance font-heading text-4xl font-medium tracking-normal sm:text-5xl sm:leading-none">
|
|
Building blocks for your next backend.
|
|
</h1>
|
|
</section>
|
|
|
|
<section
|
|
className="mx-auto flex max-w-7xl flex-col gap-12 px-4 pb-16 md:px-8 md:pb-24"
|
|
aria-labelledby="catalog-heading"
|
|
>
|
|
<h2 id="catalog-heading" className="sr-only">
|
|
Browse blocks
|
|
</h2>
|
|
<div className="flex flex-col gap-3 border-b pb-12">
|
|
<span id="category-label" className="text-xs font-medium text-foreground-lighter">
|
|
Category
|
|
</span>
|
|
<div
|
|
role="group"
|
|
aria-labelledby="category-label"
|
|
className="grid w-fit max-w-full grid-cols-2 gap-x-4 gap-y-2 sm:grid-cols-3"
|
|
>
|
|
{['All', ...libraryCategories.map((category) => category.name)].map((category) => (
|
|
<Button
|
|
key={category}
|
|
variant="text"
|
|
aria-pressed={activeCategory === category}
|
|
onClick={() => selectCategory(category)}
|
|
className={cn(
|
|
'h-auto min-w-0 justify-start rounded-sm border-0 p-0 text-left text-sm leading-6 hover:bg-transparent hover:text-foreground',
|
|
activeCategory === category ? 'text-foreground' : 'text-foreground-light'
|
|
)}
|
|
>
|
|
{category}
|
|
</Button>
|
|
))}
|
|
</div>
|
|
</div>
|
|
|
|
<p className="sr-only" role="status">
|
|
{filtered.length} blocks found
|
|
</p>
|
|
{sections.length > 0 ? (
|
|
<div className="flex flex-col gap-12">
|
|
{sections.map((section) => (
|
|
<section
|
|
key={section.slug}
|
|
id={section.slug}
|
|
aria-labelledby={`${section.slug}-heading`}
|
|
className="flex flex-col gap-8"
|
|
>
|
|
<div className="flex flex-col gap-0">
|
|
<h2 id={`${section.slug}-heading`} className="text-lg text-foreground">
|
|
{section.name}
|
|
</h2>
|
|
<p className="text-lg text-foreground-muted">{section.description}</p>
|
|
</div>
|
|
<div className="flex flex-wrap gap-6">
|
|
{section.items.map((block) => (
|
|
<LibraryCard key={block.slug} block={block} framework={framework} />
|
|
))}
|
|
</div>
|
|
</section>
|
|
))}
|
|
</div>
|
|
) : (
|
|
<div className="flex min-h-72 flex-col items-center justify-center gap-2 text-center">
|
|
<p className="text-sm font-medium">No blocks found</p>
|
|
<p className="text-lg text-foreground-muted">Try another category.</p>
|
|
<Button
|
|
variant="default"
|
|
className="mt-3"
|
|
onClick={() => {
|
|
selectCategory('All')
|
|
}}
|
|
>
|
|
Clear filters
|
|
</Button>
|
|
</div>
|
|
)}
|
|
<div className="flex flex-col justify-between gap-5 border-t pt-8 sm:flex-row sm:items-center">
|
|
<p className="max-w-xl text-lg text-foreground-muted">
|
|
Components, blocks, and starter apps for Supabase. Add blocks to your project with a
|
|
single command.
|
|
</p>
|
|
<div className="flex flex-wrap items-center gap-3">
|
|
<Button asChild variant="default">
|
|
<Link href="/docs/getting-started/quickstart">Get started</Link>
|
|
</Button>
|
|
<Button asChild variant="text" iconRight={<ArrowUpRight className="size-3.5" />}>
|
|
<a href="https://supabase.com/docs/guides/ai-tools/ai-skills">Install skills</a>
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</main>
|
|
)
|
|
}
|