Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
chore: add stories for TableEmpty and TableLoader
  • Loading branch information
aslilac committed Feb 29, 2024
commit 9ad5f7cea2c2e639419ff69e09e50454f2d54ff8
5 changes: 2 additions & 3 deletions site/src/components/EmptyState/EmptyState.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import type { FC, ReactNode } from "react";
import type { FC, HTMLAttributes, ReactNode } from "react";

export interface EmptyStateProps {
export interface EmptyStateProps extends HTMLAttributes<HTMLDivElement> {
/** Text Message to display, placed inside Typography component */
message: string;
/** Longer optional description to display below the message */
description?: string | ReactNode;
cta?: ReactNode;
className?: string;
image?: ReactNode;
}

Expand Down
52 changes: 52 additions & 0 deletions site/src/components/TableEmpty/TableEmpty.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import type { Meta, StoryObj } from "@storybook/react";
import Table from "@mui/material/Table";
import TableBody from "@mui/material/TableBody";
import TableContainer from "@mui/material/TableContainer";
import { CodeExample } from "components/CodeExample/CodeExample";
import { TableEmpty } from "./TableEmpty";

const meta: Meta<typeof TableEmpty> = {
title: "components/TableEmpty",
component: TableEmpty,
args: {
message: "Unfortunately, there's a radio connected to my brain",
},
decorators: [
(Story) => (
<TableContainer>
<Table>
<TableBody>
<Story />
</TableBody>
</Table>
</TableContainer>
),
],
};

export default meta;
type Story = StoryObj<typeof TableEmpty>;

export const Example: Story = {};

export const WithImageAndCta: Story = {
name: "With Image and CTA",
args: {
description: "Actually, it's the BBC controlling us from London",
cta: <CodeExample secret={false} code="radio eject /dev/brain" />,
image: (
<img
src="/featured/templates.webp"
alt=""
css={{
maxWidth: 800,
height: 320,
overflow: "hidden",
objectFit: "cover",
objectPosition: "top",
}}
/>
),
style: { paddingBottom: 0 },
},
};
27 changes: 27 additions & 0 deletions site/src/components/TableLoader/TableLoader.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { Meta, StoryObj } from "@storybook/react";
import Table from "@mui/material/Table";
import TableBody from "@mui/material/TableBody";
import TableContainer from "@mui/material/TableContainer";
import { TableLoader } from "./TableLoader";

const meta: Meta<typeof TableLoader> = {
title: "components/TableLoader",
component: TableLoader,
decorators: [
(Story) => (
<TableContainer>
<Table>
<TableBody>
<Story />
</TableBody>
</Table>
</TableContainer>
),
],
};

export default meta;
type Story = StoryObj<typeof TableLoader>;

export const Example: Story = {};
export { Example as TableLoader };