1
1
import type { Meta , StoryObj } from "@storybook/react" ;
2
2
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" ;
3
9
import { AppBody as AppShellComponent } from "./index.jsx" ;
4
10
5
11
const meta = {
6
12
component : AppShellComponent ,
13
+ subcomponents : { ErrorPage, NoResults, NotFoundPage } ,
7
14
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
+ } ,
8
24
bare : true ,
9
25
theme : {
10
26
disable : true ,
@@ -35,17 +51,54 @@ const meta = {
35
51
} ,
36
52
} ,
37
53
} ,
54
+ tags : [ "autodocs" ] ,
38
55
} satisfies Meta < typeof AppShellComponent > ;
39
56
export default meta ;
40
57
41
58
export const AppShell = {
42
59
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 ,
50
61
} ,
62
+ render : ( args ) => (
63
+ < AppShellComponent { ...args } >
64
+ < InfoBox >
65
+ { args . children }
66
+ </ InfoBox >
67
+ </ AppShellComponent >
68
+ )
51
69
} 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
+ } ;
0 commit comments