mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: add stories for TableEmpty and TableLoader (#12373)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
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: "A gruff voice crackles to life on the intercom.",
|
||||
cta: (
|
||||
<CodeExample
|
||||
secret={false}
|
||||
code="say “Actually, it's the BBC controlling us from London”"
|
||||
/>
|
||||
),
|
||||
image: (
|
||||
<img
|
||||
src="/featured/templates.webp"
|
||||
alt=""
|
||||
css={{
|
||||
maxWidth: 800,
|
||||
height: 320,
|
||||
overflow: "hidden",
|
||||
objectFit: "cover",
|
||||
objectPosition: "top",
|
||||
}}
|
||||
/>
|
||||
),
|
||||
style: { paddingBottom: 0 },
|
||||
},
|
||||
};
|
||||
@@ -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 };
|
||||
Reference in New Issue
Block a user