From 9ad5f7cea2c2e639419ff69e09e50454f2d54ff8 Mon Sep 17 00:00:00 2001 From: McKayla Washburn Date: Thu, 29 Feb 2024 21:39:45 +0000 Subject: [PATCH 1/2] chore: add stories for `TableEmpty` and `TableLoader` --- site/src/components/EmptyState/EmptyState.tsx | 5 +- .../TableEmpty/TableEmpty.stories.tsx | 52 +++++++++++++++++++ .../TableLoader/TableLoader.stories.tsx | 27 ++++++++++ 3 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 site/src/components/TableEmpty/TableEmpty.stories.tsx create mode 100644 site/src/components/TableLoader/TableLoader.stories.tsx diff --git a/site/src/components/EmptyState/EmptyState.tsx b/site/src/components/EmptyState/EmptyState.tsx index a36069db4ce4a..5fcff30902189 100644 --- a/site/src/components/EmptyState/EmptyState.tsx +++ b/site/src/components/EmptyState/EmptyState.tsx @@ -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 { /** 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; } diff --git a/site/src/components/TableEmpty/TableEmpty.stories.tsx b/site/src/components/TableEmpty/TableEmpty.stories.tsx new file mode 100644 index 0000000000000..f7bc7d99a5cf2 --- /dev/null +++ b/site/src/components/TableEmpty/TableEmpty.stories.tsx @@ -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 = { + title: "components/TableEmpty", + component: TableEmpty, + args: { + message: "Unfortunately, there's a radio connected to my brain", + }, + decorators: [ + (Story) => ( + + + + + +
+
+ ), + ], +}; + +export default meta; +type Story = StoryObj; + +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: , + image: ( + + ), + style: { paddingBottom: 0 }, + }, +}; diff --git a/site/src/components/TableLoader/TableLoader.stories.tsx b/site/src/components/TableLoader/TableLoader.stories.tsx new file mode 100644 index 0000000000000..29d14f1eb069f --- /dev/null +++ b/site/src/components/TableLoader/TableLoader.stories.tsx @@ -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 = { + title: "components/TableLoader", + component: TableLoader, + decorators: [ + (Story) => ( + + + + + +
+
+ ), + ], +}; + +export default meta; +type Story = StoryObj; + +export const Example: Story = {}; +export { Example as TableLoader }; From c193d25f87da267e6dc3c6b587030639b86f8d0d Mon Sep 17 00:00:00 2001 From: McKayla Washburn Date: Thu, 29 Feb 2024 21:49:11 +0000 Subject: [PATCH 2/2] actually, this is funnier --- site/src/components/TableEmpty/TableEmpty.stories.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/site/src/components/TableEmpty/TableEmpty.stories.tsx b/site/src/components/TableEmpty/TableEmpty.stories.tsx index f7bc7d99a5cf2..b9ddec5e883f4 100644 --- a/site/src/components/TableEmpty/TableEmpty.stories.tsx +++ b/site/src/components/TableEmpty/TableEmpty.stories.tsx @@ -32,8 +32,13 @@ 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: , + description: "A gruff voice crackles to life on the intercom.", + cta: ( + + ), image: (