Skip to content

Commit 5d242f1

Browse files
committed
docs: add ErrorPage, NoResults, and NotFoundPage as subcomponents of AppShell stories
1 parent c10b3ca commit 5d242f1

File tree

2 files changed

+62
-9
lines changed

2 files changed

+62
-9
lines changed

packages/component-library/src/AppShell/index.stories.tsx

Lines changed: 60 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
import type { Meta, StoryObj } from "@storybook/react";
22

3+
import { ErrorPage, type Props as ErrorPageProps } from "../ErrorPage/index.jsx";
4+
import { NetworkError as NetworkErrorStory } from "../ErrorPage/index.stories.jsx";
5+
import { InfoBox } from "../InfoBox/index.jsx";
6+
import { NoResults, type Props as NoResultsProps } from "../NoResults/index.jsx";
7+
import { WarningVariant as WarningVariantStory } from "../NoResults/index.stories.jsx";
8+
import { NotFoundPage } from "../NotFoundPage/index.jsx";
39
import { AppBody as AppShellComponent } from "./index.jsx";
410

511
const meta = {
612
component: AppShellComponent,
13+
subcomponents: { ErrorPage, NoResults, NotFoundPage },
714
globals: {
15+
args: {
16+
appName: "Component Library",
17+
children: "Hello world!",
18+
tabs: [
19+
{ children: "Home", segment: "" },
20+
{ children: "Products", segment: "products" },
21+
{ children: "Developers", segment: "developers" },
22+
],
23+
},
824
bare: true,
925
theme: {
1026
disable: true,
@@ -35,17 +51,54 @@ const meta = {
3551
},
3652
},
3753
},
54+
tags: ["autodocs"],
3855
} satisfies Meta<typeof AppShellComponent>;
3956
export default meta;
4057

4158
export const AppShell = {
4259
args: {
43-
appName: "Component Library",
44-
children: "Hello world!",
45-
tabs: [
46-
{ children: "Home", segment: "" },
47-
{ children: "Foo", segment: "foo" },
48-
{ children: "Bar", segment: "bar" },
49-
],
60+
...meta.globals?.args,
5061
},
62+
render: (args) => (
63+
<AppShellComponent {...args}>
64+
<InfoBox>
65+
{args.children}
66+
</InfoBox>
67+
</AppShellComponent>
68+
)
5169
} satisfies StoryObj<typeof AppShellComponent>;
70+
71+
type Story = StoryObj<typeof meta>;
72+
73+
export const ErrorStory: Story = {
74+
args: {
75+
...meta.globals?.args,
76+
},
77+
render: (args) => (
78+
<AppShellComponent {...args}>
79+
<ErrorPage {...NetworkErrorStory.args as ErrorPageProps} />
80+
</AppShellComponent>
81+
)
82+
};
83+
84+
export const NoResultsStory: Story = {
85+
args: {
86+
...meta.globals?.args,
87+
},
88+
render: (args) => (
89+
<AppShellComponent {...args}>
90+
<NoResults {...WarningVariantStory.args as NoResultsProps} />
91+
</AppShellComponent>
92+
)
93+
};
94+
95+
export const NotFoundStory: Story = {
96+
args: {
97+
...meta.globals?.args,
98+
},
99+
render: (args) => (
100+
<AppShellComponent {...args}>
101+
<NotFoundPage />
102+
</AppShellComponent>
103+
)
104+
};

packages/component-library/src/NoResults/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { MagnifyingGlass } from "@phosphor-icons/react/dist/ssr/MagnifyingGlass"
44
import clsx from "clsx";
55
import type { ReactNode } from "react";
66

7-
import styles from "./index.module.scss";
87
import { Button } from "../Button/index.jsx";
8+
import styles from "./index.module.scss";
99

10-
type Props = {
10+
export type Props = {
1111
className?: string | undefined;
1212
onClearSearch?: (() => void) | undefined;
1313
} & (

0 commit comments

Comments
 (0)