Skip to content

Commit f00935b

Browse files
authored
chore: add stories for TableEmpty and TableLoader (#12373)
1 parent b1c2fea commit f00935b

File tree

3 files changed

+86
-3
lines changed

3 files changed

+86
-3
lines changed

site/src/components/EmptyState/EmptyState.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import type { FC, ReactNode } from "react";
1+
import type { FC, HTMLAttributes, ReactNode } from "react";
22

3-
export interface EmptyStateProps {
3+
export interface EmptyStateProps extends HTMLAttributes<HTMLDivElement> {
44
/** Text Message to display, placed inside Typography component */
55
message: string;
66
/** Longer optional description to display below the message */
77
description?: string | ReactNode;
88
cta?: ReactNode;
9-
className?: string;
109
image?: ReactNode;
1110
}
1211

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import type { Meta, StoryObj } from "@storybook/react";
2+
import Table from "@mui/material/Table";
3+
import TableBody from "@mui/material/TableBody";
4+
import TableContainer from "@mui/material/TableContainer";
5+
import { CodeExample } from "components/CodeExample/CodeExample";
6+
import { TableEmpty } from "./TableEmpty";
7+
8+
const meta: Meta<typeof TableEmpty> = {
9+
title: "components/TableEmpty",
10+
component: TableEmpty,
11+
args: {
12+
message: "Unfortunately, there's a radio connected to my brain",
13+
},
14+
decorators: [
15+
(Story) => (
16+
<TableContainer>
17+
<Table>
18+
<TableBody>
19+
<Story />
20+
</TableBody>
21+
</Table>
22+
</TableContainer>
23+
),
24+
],
25+
};
26+
27+
export default meta;
28+
type Story = StoryObj<typeof TableEmpty>;
29+
30+
export const Example: Story = {};
31+
32+
export const WithImageAndCta: Story = {
33+
name: "With Image and CTA",
34+
args: {
35+
description: "A gruff voice crackles to life on the intercom.",
36+
cta: (
37+
<CodeExample
38+
secret={false}
39+
code="say &ldquo;Actually, it's the BBC controlling us from London&rdquo;"
40+
/>
41+
),
42+
image: (
43+
<img
44+
src="/featured/templates.webp"
45+
alt=""
46+
css={{
47+
maxWidth: 800,
48+
height: 320,
49+
overflow: "hidden",
50+
objectFit: "cover",
51+
objectPosition: "top",
52+
}}
53+
/>
54+
),
55+
style: { paddingBottom: 0 },
56+
},
57+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import type { Meta, StoryObj } from "@storybook/react";
2+
import Table from "@mui/material/Table";
3+
import TableBody from "@mui/material/TableBody";
4+
import TableContainer from "@mui/material/TableContainer";
5+
import { TableLoader } from "./TableLoader";
6+
7+
const meta: Meta<typeof TableLoader> = {
8+
title: "components/TableLoader",
9+
component: TableLoader,
10+
decorators: [
11+
(Story) => (
12+
<TableContainer>
13+
<Table>
14+
<TableBody>
15+
<Story />
16+
</TableBody>
17+
</Table>
18+
</TableContainer>
19+
),
20+
],
21+
};
22+
23+
export default meta;
24+
type Story = StoryObj<typeof TableLoader>;
25+
26+
export const Example: Story = {};
27+
export { Example as TableLoader };

0 commit comments

Comments
 (0)