Skip to content

Commit cad19a0

Browse files
committed
Empty state
1 parent 7238fc4 commit cad19a0

File tree

5 files changed

+64
-2
lines changed

5 files changed

+64
-2
lines changed

src/components.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { ButtonsDemo } from '~/demos/buttons-demo';
99
import { sidebarHighlight } from '~/demos/callbacks/sidebar';
1010
import { CheckboxesDemo } from '~/demos/checkboxes-demo';
1111
import { DetailsDemo } from '~/demos/details-demo';
12+
import { EmptyStateDemo } from '~/demos/empty-state-demo';
1213
import { ErrorFallbackDemo } from '~/demos/error-fallback-demo';
1314
import { FormSubmitDemo } from '~/demos/form-submit-demo';
1415
import { FormValidationGroupDemo } from '~/demos/form-validation-group-demo';
@@ -66,15 +67,15 @@ export function Components(props: ComponentsProps) {
6667
</SidebarListLink>
6768
<SidebarListLink href="#button-links-demo">
6869
<Box />
69-
Button Links
70+
Button links
7071
</SidebarListLink>
7172
<SidebarListLink href="#alerts-demo">
7273
<Box />
7374
Alerts
7475
</SidebarListLink>
7576
<SidebarListLink href="#badge-and-count-demo">
7677
<Box />
77-
Badge and Count
78+
Badge and count
7879
</SidebarListLink>
7980
<SidebarListLink href="#checkboxes-demo">
8081
<Box />
@@ -84,6 +85,10 @@ export function Components(props: ComponentsProps) {
8485
<Box />
8586
Details
8687
</SidebarListLink>
88+
<SidebarListLink href="#empty-state-demo">
89+
<Box />
90+
Empty state
91+
</SidebarListLink>
8792
<SidebarListLink href="#error-fallback-demo">
8893
<Box />
8994
Error fallback
@@ -198,6 +203,7 @@ export function Components(props: ComponentsProps) {
198203
<BadgeAndCountDemo />
199204
<CheckboxesDemo />
200205
<DetailsDemo />
206+
<EmptyStateDemo />
201207
<ErrorFallbackDemo />
202208
<FormSubmitDemo />
203209
<FormValidationGroupDemo />
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { expect, test } from '@playwright/test';
2+
3+
import { describeComponent } from '~/demos/test-utils/demo-e2e-helpers';
4+
5+
describeComponent('empty-state-demo', (getContainer) => {
6+
test('renders empty state', async () => {
7+
const container = getContainer();
8+
const emptyState = container.locator('.o-empty-state');
9+
await expect(emptyState).toBeVisible();
10+
});
11+
});

src/demos/empty-state-demo.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import {
2+
Card,
3+
CardContent,
4+
CardDescription,
5+
CardHeader,
6+
CardTitle,
7+
} from '~/shared/components/card';
8+
9+
export function EmptyStateDemo() {
10+
return (
11+
<Card id="empty-state-demo">
12+
<CardHeader>
13+
<CardTitle>Empty State Demo</CardTitle>
14+
<CardDescription>Plain box used to indicate content missing</CardDescription>
15+
</CardHeader>
16+
<CardContent>
17+
<div class="o-stack">
18+
<div class="o-empty-state">
19+
<p>There’s nothing here yet.</p>
20+
</div>
21+
</div>
22+
</CardContent>
23+
</Card>
24+
);
25+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* Badge styles for displaying status or notifications */
2+
@define-mixin o-empty-state {
3+
@mixin v-text-muted;
4+
@mixin t-radius-outer;
5+
@mixin t-border;
6+
7+
display: flex;
8+
align-items: center;
9+
min-height: 6lh;
10+
justify-content: center;
11+
padding: var(--v-spacing);
12+
}
13+
14+
@layer objects {
15+
.o-empty-state {
16+
@mixin v-colors-card;
17+
@mixin o-empty-state;
18+
}
19+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@import './badge.css';
22
@import './box.css';
33
@import './container.css';
4+
@import './empty-state.css';
45
@import './grid.css';
56
@import './group.css';
67
@import './stack.css';

0 commit comments

Comments
 (0)