1
1
import type { Meta , StoryObj } from "@storybook/react" ;
2
- import { Alert } from "flowbite-react" ;
2
+ import { Alert , AlertProps } from "flowbite-react" ;
3
+ import { FC } from "react" ;
4
+ import { Link } from "../../Typography" ;
5
+
6
+ type ContentProps = { color : AlertProps [ "color" ] } ;
7
+ const Content : FC < ContentProps > = ( { color } ) => {
8
+ return (
9
+ < >
10
+ { color } : Lorem ipsum dolor,{ " " }
11
+ < Link href = "#" > sit amet consectetur adipisicing elit.</ Link >
12
+ </ >
13
+ ) ;
14
+ } ;
3
15
4
16
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
5
17
const meta : Meta < typeof Alert > = {
@@ -15,10 +27,22 @@ const meta: Meta<typeof Alert> = {
15
27
args : { } ,
16
28
render : ( { children, ...args } ) => (
17
29
< div className = "space-y-2" >
18
- < Alert { ...args } color = { "info" } children = { "Info: " + children } />
19
- < Alert { ...args } color = { "warning" } children = { "Warning: " + children } />
20
- < Alert { ...args } color = { "failure" } children = { "Failure: " + children } />
21
- < Alert { ...args } color = { "success" } children = { "Success: " + children } />
30
+ < Alert { ...args } color = { "info" } children = { < Content color = { "info" } /> } />
31
+ < Alert
32
+ { ...args }
33
+ color = { "warning" }
34
+ children = { < Content color = { "warning" } /> }
35
+ />
36
+ < Alert
37
+ { ...args }
38
+ color = { "failure" }
39
+ children = { < Content color = { "failure" } /> }
40
+ />
41
+ < Alert
42
+ { ...args }
43
+ color = { "success" }
44
+ children = { < Content color = { "success" } /> }
45
+ />
22
46
</ div >
23
47
) ,
24
48
} ;
@@ -29,7 +53,5 @@ type Story = StoryObj<typeof Alert>;
29
53
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
30
54
export const Message : Story = {
31
55
// More on args: https://storybook.js.org/docs/react/writing-stories/args
32
- args : {
33
- children : "Lorem ipsum dolor, sit amet consectetur adipisicing elit." ,
34
- } ,
56
+ args : { } ,
35
57
} ;
0 commit comments