mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
chore(design-system): empty state documentation (#39890)
* suppress webpack/Turbopack warning * empty states first draft * todo note * empty state documentation * remove empty code block and confusing examples
This commit is contained in:
1 parent
faf1167bf4
commit
83bdc22723
9 files changed
+183
-34
No files matched your search
@@ -58,13 +58,13 @@ The design system _references_ components rather than housing them. That’s an
|
||||
With that out of the way, there are several parts of this design system that need to be manually updated after components have been added or removed (from documentation). These include:
|
||||
|
||||
- `config/docs.ts`: list of components in the sidebar
|
||||
- `content/docs`: where the actual component documentation `.mdx` file lives
|
||||
- `content/docs`: the actual component documentation
|
||||
- `registry/examples.ts`: list of example components
|
||||
- `registry/default/example`: where the actual example component(s) live
|
||||
- `registry/charts.ts`: Chart components
|
||||
- `registry/fragments.ts`: Fragment components
|
||||
- `registry/default/example`: the actual example components
|
||||
- `registry/charts.ts`: chart components
|
||||
- `registry/fragments.ts`: fragment components
|
||||
|
||||
You will need to rebuild the design system’s registry each time a new example component is added. In other words: whenever a new file enters `registry`, it needs to be rebuilt. You can do that via:
|
||||
You may need to rebuild the design system’s registry. You can do that via:
|
||||
|
||||
```bash
|
||||
cd apps/design-system
|
||||
|
||||
@@ -2293,6 +2293,39 @@ export const Index: Record<string, any> = {
|
||||
subcategory: "undefined",
|
||||
chunks: []
|
||||
},
|
||||
"empty-state-missing-route": {
|
||||
name: "empty-state-missing-route",
|
||||
type: "components:example",
|
||||
registryDependencies: undefined,
|
||||
component: React.lazy(() => import("@/registry/default/example/empty-state-missing-route")),
|
||||
source: "",
|
||||
files: ["registry/default/example/empty-state-missing-route.tsx"],
|
||||
category: "undefined",
|
||||
subcategory: "undefined",
|
||||
chunks: []
|
||||
},
|
||||
"empty-state-zero-items-table": {
|
||||
name: "empty-state-zero-items-table",
|
||||
type: "components:example",
|
||||
registryDependencies: undefined,
|
||||
component: React.lazy(() => import("@/registry/default/example/empty-state-zero-items-table")),
|
||||
source: "",
|
||||
files: ["registry/default/example/empty-state-zero-items-table.tsx"],
|
||||
category: "undefined",
|
||||
subcategory: "undefined",
|
||||
chunks: []
|
||||
},
|
||||
"empty-state-initial-state": {
|
||||
name: "empty-state-initial-state",
|
||||
type: "components:example",
|
||||
registryDependencies: undefined,
|
||||
component: React.lazy(() => import("@/registry/default/example/empty-state-initial-state")),
|
||||
source: "",
|
||||
files: ["registry/default/example/empty-state-initial-state.tsx"],
|
||||
category: "undefined",
|
||||
subcategory: "undefined",
|
||||
chunks: []
|
||||
},
|
||||
"chart-area-axes": {
|
||||
name: "chart-area-axes",
|
||||
type: "components:block",
|
||||
|
||||
@@ -6,28 +6,6 @@ interface DocsConfig {
|
||||
}
|
||||
|
||||
export const docsConfig: DocsConfig = {
|
||||
// mainNav: [
|
||||
// {
|
||||
// title: 'Documentation',
|
||||
// href: '/docs',
|
||||
// },
|
||||
// {
|
||||
// title: 'Components',
|
||||
// href: '/docs/components/accordion',
|
||||
// },
|
||||
// {
|
||||
// title: 'Themes',
|
||||
// href: '/themes',
|
||||
// },
|
||||
// {
|
||||
// title: 'Examples',
|
||||
// href: '/examples',
|
||||
// },
|
||||
// {
|
||||
// title: 'Blocks',
|
||||
// href: '/blocks',
|
||||
// },
|
||||
// ],
|
||||
sidebarNav: [
|
||||
{
|
||||
title: 'Getting Started',
|
||||
@@ -77,6 +55,11 @@ export const docsConfig: DocsConfig = {
|
||||
href: '/docs/ui-patterns/navigation',
|
||||
items: [],
|
||||
},
|
||||
{
|
||||
title: 'Empty States',
|
||||
href: '/docs/ui-patterns/empty-states',
|
||||
items: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
title: Empty states
|
||||
description: Convey the absence of data and provide clear instruction for what to do about it.
|
||||
---
|
||||
|
||||
At a minimum, empty states convey the fact that there is nothing to list, perform, or display on the current page. They should also provide a clear call to action for the user to take.
|
||||
|
||||
## Missing route
|
||||
|
||||
Users may accidentally navigate to a non-existent dynamic route, such as a non-existent bucket in [Storage](https://supabase.com/dashboard/project/_/storage) or a non-existent table in the [Table Editor](https://supabase.com/dashboard/project/_/editor). In these cases, follow the pattern of a centered [Admonition](../fragments/admonition) as shown below..
|
||||
|
||||
<ComponentPreview name="empty-state-missing-route" peekCode wide />
|
||||
|
||||
## Zero results
|
||||
|
||||
Tabular information without results—or perhaps no data to begin with—should have an empty state that matches the larger presentation.
|
||||
|
||||
For instance, a [Table](../components/table) may just display a single row just like it would if it had data. Dulling the TableHead text color and removing the TableCell hover state can further reinforce the lack of usable data.
|
||||
|
||||
<ComponentPreview name="empty-state-zero-items-table" peekCode wide />
|
||||
|
||||
The treatment for other layouts, such as the list of users in [Authentication](https://supabase.com/dashboard/project/_/auth/users), should match their own general styling.
|
||||
|
||||
## Initial state
|
||||
|
||||
Perhaps the user has not yet created any data yet. They might be a feature for the first time. In these cases, the empty state should provide the briefest information about the lack of data, putting more focus on the value proposition and primary action.
|
||||
|
||||
<ComponentPreview name="empty-state-initial-state" peekCode wide />
|
||||
|
||||
Keep in mind that this empty state will likely appear after a visual loading state. Consider layout shift and button placement during and after the transition.
|
||||
|
||||
## Components
|
||||
|
||||
There is not yet a shared empty state UI component. The context and needs for each placement differ enough to warrant custom components for each placement. That said, we should aim to make these as consistent as possible over time. See the below examples that might share common logic in a future centralized component.
|
||||
|
||||
## External references
|
||||
|
||||
- [_Empty States_ on GitHub Primer](https://primer.style/product/ui-patterns/empty-states/)
|
||||
@@ -26,16 +26,27 @@ const nextConfig = {
|
||||
return [
|
||||
...(BASE_PATH.length
|
||||
? [
|
||||
{
|
||||
source: '/',
|
||||
destination: BASE_PATH,
|
||||
basePath: false,
|
||||
permanent: false,
|
||||
},
|
||||
]
|
||||
{
|
||||
source: '/',
|
||||
destination: BASE_PATH,
|
||||
basePath: false,
|
||||
permanent: false,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
]
|
||||
},
|
||||
// Turbopack configuration to handle .md files with raw-loader
|
||||
// This mirrors the webpack configuration added by withContentlayer
|
||||
// and ensures both bundlers can process content files properly
|
||||
turbopack: {
|
||||
rules: {
|
||||
'*.md': {
|
||||
loaders: ['raw-loader'],
|
||||
as: '*.js',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export default withContentlayer(nextConfig)
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Button } from 'ui'
|
||||
import { Plus } from 'lucide-react'
|
||||
import { BucketAdd } from 'icons'
|
||||
|
||||
export default function EmptyStateInitialState() {
|
||||
return (
|
||||
<aside className="border border-dashed w-full bg-surface-100 rounded-lg px-4 py-10 flex flex-col gap-y-4 items-center text-center gap-1 text-balance">
|
||||
<div className="flex flex-col gap-3 items-center text-center">
|
||||
<BucketAdd size={24} strokeWidth={1.5} className="text-foreground-muted" />
|
||||
<div className="flex flex-col gap-1">
|
||||
<h3>Create a vector bucket</h3>
|
||||
<p className="text-foreground-light text-sm">
|
||||
Store, index, and query your vector embeddings at scale.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<Button size="tiny" type="primary" className="w-fit" icon={<Plus size={14} />}>
|
||||
Create bucket
|
||||
</Button>
|
||||
</aside>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Admonition } from 'ui-patterns/admonition'
|
||||
import Link from 'next/link'
|
||||
import { Button } from 'ui'
|
||||
|
||||
const bucketId = 'user_avatars'
|
||||
|
||||
export default function EmptyStateMissingRoute() {
|
||||
return (
|
||||
<div className="flex items-center justify-center w-full h-full">
|
||||
<Admonition
|
||||
type="default"
|
||||
className="max-w-md"
|
||||
title="Unable to find bucket"
|
||||
description={`${bucketId ? `The bucket “${bucketId}”` : 'This bucket'} doesn’t seem to exist.`}
|
||||
>
|
||||
<Button asChild type="default" className="mt-2">
|
||||
<Link href="/">Head back</Link>
|
||||
</Button>
|
||||
</Admonition>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { Card, Table, TableBody, TableHead, TableHeader, TableRow, TableCell } from 'ui'
|
||||
|
||||
export default function EmptyStateZeroItemsTable() {
|
||||
return (
|
||||
<Card className="w-full">
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="text-foreground-muted">Table name</TableHead>
|
||||
<TableHead className="text-foreground-muted">Date created</TableHead>
|
||||
<TableHead />
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
<TableRow className="[&>td]:hover:bg-inherit">
|
||||
<TableCell colSpan={3}>
|
||||
<p className="text-sm text-foreground">No tables yet</p>
|
||||
<p className="text-sm text-foreground-lighter">Connect a table from your database</p>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
@@ -1263,4 +1263,19 @@ export const examples: Registry = [
|
||||
type: 'components:example',
|
||||
files: ['example/logs-bar-chart.tsx'],
|
||||
},
|
||||
{
|
||||
name: 'empty-state-missing-route',
|
||||
type: 'components:example',
|
||||
files: ['example/empty-state-missing-route.tsx'],
|
||||
},
|
||||
{
|
||||
name: 'empty-state-zero-items-table',
|
||||
type: 'components:example',
|
||||
files: ['example/empty-state-zero-items-table.tsx'],
|
||||
},
|
||||
{
|
||||
name: 'empty-state-initial-state',
|
||||
type: 'components:example',
|
||||
files: ['example/empty-state-initial-state.tsx'],
|
||||
},
|
||||
]
|
||||
Reference in new issue
Block a user