Skip to content

Commit 40f7abc

Browse files
authored
docs(design-system): design system improvements (supabase#40196)
* font smoothing * remove sidebar * fix typo * data grid empty state * basic data grid * remove figma * empty state docs
1 parent dee40fe commit 40f7abc

File tree

15 files changed

+176
-148
lines changed

15 files changed

+176
-148
lines changed

apps/design-system/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ With that out of the way, there are several parts of this design system that nee
6464
- `registry/charts.ts`: chart components
6565
- `registry/fragments.ts`: fragment components
6666

67-
You may need to rebuild the design system’s registry. You can do that via:
67+
You will probably need to rebuild the design system’s registry after making new additions. You can do that via:
6868

6969
```bash
7070
cd apps/design-system

apps/design-system/__registry__/index.tsx

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2315,13 +2315,35 @@ export const Index: Record<string, any> = {
23152315
subcategory: "undefined",
23162316
chunks: []
23172317
},
2318-
"empty-state-initial-state": {
2319-
name: "empty-state-initial-state",
2318+
"empty-state-initial-state-presentational": {
2319+
name: "empty-state-initial-state-presentational",
23202320
type: "components:example",
23212321
registryDependencies: undefined,
2322-
component: React.lazy(() => import("@/registry/default/example/empty-state-initial-state")),
2322+
component: React.lazy(() => import("@/registry/default/example/empty-state-initial-state-presentational")),
23232323
source: "",
2324-
files: ["registry/default/example/empty-state-initial-state.tsx"],
2324+
files: ["registry/default/example/empty-state-initial-state-presentational.tsx"],
2325+
category: "undefined",
2326+
subcategory: "undefined",
2327+
chunks: []
2328+
},
2329+
"empty-state-initial-state-informational": {
2330+
name: "empty-state-initial-state-informational",
2331+
type: "components:example",
2332+
registryDependencies: undefined,
2333+
component: React.lazy(() => import("@/registry/default/example/empty-state-initial-state-informational")),
2334+
source: "",
2335+
files: ["registry/default/example/empty-state-initial-state-informational.tsx"],
2336+
category: "undefined",
2337+
subcategory: "undefined",
2338+
chunks: []
2339+
},
2340+
"empty-state-zero-items-data-grid": {
2341+
name: "empty-state-zero-items-data-grid",
2342+
type: "components:example",
2343+
registryDependencies: undefined,
2344+
component: React.lazy(() => import("@/registry/default/example/empty-state-zero-items-data-grid")),
2345+
source: "",
2346+
files: ["registry/default/example/empty-state-zero-items-data-grid.tsx"],
23252347
category: "undefined",
23262348
subcategory: "undefined",
23272349
chunks: []

apps/design-system/config/docs.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,6 @@ export const docsConfig: DocsConfig = {
3535
href: '/docs/icons',
3636
items: [],
3737
},
38-
{
39-
title: 'Figma',
40-
href: '/docs/figma',
41-
items: [],
42-
},
43-
{
44-
title: 'Changelog',
45-
href: '/docs/changelog',
46-
items: [],
47-
},
4838
],
4939
},
5040
{

apps/design-system/content/docs/changelog.mdx

Lines changed: 0 additions & 84 deletions
This file was deleted.

apps/design-system/content/docs/figma.mdx

Lines changed: 0 additions & 28 deletions
This file was deleted.

apps/design-system/content/docs/ui-patterns/empty-states.mdx

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,60 @@ title: Empty states
33
description: Convey the absence of data and provide clear instruction for what to do about it.
44
---
55

6-
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.
6+
Empty states convey the fact that there is nothing to list, perform, or display on the current page. **Ideally**, they also provide a clear action for the user to take.
77

88
## Missing route
99

10-
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..
10+
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.
1111

1212
<ComponentPreview name="empty-state-missing-route" peekCode wide />
1313

14-
## Zero results
14+
## No data
1515

16-
Tabular information without results—or perhaps no data to begin with—should have an empty state that matches the larger presentation.
16+
There are two ways an empty state may be displayed in cases where there is no data:
1717

18-
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.
18+
- **Zero results**: no data after a search or filter
19+
- **Initial state**: no data to begin with
20+
21+
### Zero results
22+
23+
Data-heavy presentations without results should have an empty state that broadly matches the state when there is data. This makes the transition between the two states more seamless.
24+
25+
#### Table
26+
27+
A [Table](../components/table) instance with zero results should display a single row. Dulling the TableHead text color and removing the TableCell hover state can further reinforce the lack of usable data.
1928

2029
<ComponentPreview name="empty-state-zero-items-table" peekCode wide />
2130

22-
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.
31+
#### DataGrid
32+
33+
[DataGrid](../components/data-table) typically spans the full height and width of a container. A classic example is [Users](https://supabase.com/dashboard/project/_/auth/users), which (as it sounds) displays a list of the project’s registered users. Any instance with zero results should display a more prominent empty with a clear title, description, and supporting illustration.
34+
35+
<ComponentPreview name="empty-state-zero-items-data-grid" peekCode wide />
36+
37+
Other DataGrid instances include [Cron Jobs](https://supabase.com/dashboard/project/_/integrations/cron/jobs) and [Queues](https://supabase.com/dashboard/project/_/integrations/queues).
38+
39+
### Initial state
40+
41+
Perhaps the user has not yet created any data. The presentation of this empty state depends on the context of the list and the type of data it contains.
42+
43+
#### Presentational
44+
45+
The user may be learning about a feature for the first time, and this experience benefits from user education or onboarding. In cases like these, the empty state should put more focus on the feature’s value proposition and an action the user can take.
46+
47+
<ComponentPreview name="empty-state-initial-state-presentational" peekCode wide />
2348

24-
## Initial state
49+
#### Informational
2550

26-
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.
51+
Or perhaps the list type is data-heavy or does not benefit from additional information. In these cases, the empty state should provide show the initial state in the same presentation as the list when there is data, much like the [zero results](#zero-results) scenario.
2752

28-
<ComponentPreview name="empty-state-initial-state" peekCode wide />
53+
<ComponentPreview name="empty-state-initial-state-informational" peekCode wide />
2954

30-
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.
55+
Keep in mind that empty states will likely appear after a visual loading state. Consider layout shift and button placement during and after the transition.
3156

3257
## Components
3358

34-
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.
59+
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.
3560

3661
## External references
3762

apps/design-system/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"next-contentlayer2": "0.4.6",
3030
"next-themes": "^0.3.0",
3131
"react": "catalog:",
32+
"react-data-grid": "7.0.0-beta.41",
3233
"react-day-picker": "^9.11.1",
3334
"react-docgen": "^7.0.3",
3435
"react-dom": "catalog:",
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { Plus } from 'lucide-react'
2+
import { Button, Card, Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from 'ui'
3+
4+
export default function EmptyStateZeroItemsTable() {
5+
return (
6+
<div className="flex flex-col gap-y-4 w-full">
7+
<Button className="w-fit self-end" type="primary" size="tiny" icon={<Plus size={14} />}>
8+
New table
9+
</Button>
10+
<Card>
11+
<Table>
12+
<TableHeader>
13+
<TableRow>
14+
<TableHead className="text-foreground-muted">Table name</TableHead>
15+
<TableHead className="text-foreground-muted">Date created</TableHead>
16+
<TableHead />
17+
</TableRow>
18+
</TableHeader>
19+
<TableBody>
20+
<TableRow className="[&>td]:hover:bg-inherit">
21+
<TableCell colSpan={3}>
22+
<p className="text-sm text-foreground">No tables yet</p>
23+
<p className="text-sm text-foreground-lighter">Create a table to get started</p>
24+
</TableCell>
25+
</TableRow>
26+
</TableBody>
27+
</Table>
28+
</Card>
29+
</div>
30+
)
31+
}

apps/design-system/registry/default/example/empty-state-initial-state.tsx renamed to apps/design-system/registry/default/example/empty-state-initial-state-presentational.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { Button } from 'ui'
2-
import { Plus } from 'lucide-react'
31
import { BucketAdd } from 'icons'
2+
import { Plus } from 'lucide-react'
3+
import { Button } from 'ui'
44

5-
export default function EmptyStateInitialState() {
5+
export default function EmptyStateInitialStatePresentational() {
66
return (
77
<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">
88
<div className="flex flex-col gap-3 items-center text-center">

apps/design-system/registry/default/example/empty-state-missing-route.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Admonition } from 'ui-patterns/admonition'
21
import Link from 'next/link'
32
import { Button } from 'ui'
3+
import { Admonition } from 'ui-patterns/admonition'
44

55
const bucketId = 'user_avatars'
66

@@ -14,7 +14,14 @@ export default function EmptyStateMissingRoute() {
1414
description={`${bucketId ? `The bucket “${bucketId}”` : 'This bucket'} doesn’t seem to exist.`}
1515
>
1616
<Button asChild type="default" className="mt-2">
17-
<Link href="/">Head back</Link>
17+
<Link
18+
href="/"
19+
onClick={(e) => {
20+
e.preventDefault()
21+
}}
22+
>
23+
Head back
24+
</Link>
1825
</Button>
1926
</Admonition>
2027
</div>

0 commit comments

Comments
 (0)