Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit b2d77b4

Browse files
committed
feat(alert): added storybook
1 parent 45ee71f commit b2d77b4

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

src/components/Alert/index.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ export const AlertIcon: Vue.Component<{}>;
1717
* Alert title component for composing alert title.
1818
*/
1919
export const AlertTitle: Vue.Component<{}>;
20+
21+
/**
22+
* Alert description component for composing alert descriptions.
23+
*/
24+
export const AlertDescription: Vue.Component<{}>;

stories/7-Alert.stories.js

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import { storiesOf } from '@storybook/vue'
2+
import centered from '@storybook/addon-centered/vue'
3+
import { Alert, AlertIcon, AlertTitle, AlertDescription } from '../src/components/Alert'
4+
5+
storiesOf('UI | Alert', module)
6+
.addDecorator(centered)
7+
.add('Default Alert', () => ({
8+
components: { Alert },
9+
template: `
10+
<div>
11+
<Alert>Kiwi is the best Vue component library</Alert>
12+
</div>
13+
`
14+
}))
15+
.add('With icon', () => ({
16+
components: { Alert, AlertIcon },
17+
template: `
18+
<div>
19+
<Alert mb="3" status="info">
20+
<AlertIcon />
21+
Kiwi is the best Vue component library
22+
</Alert>
23+
</div>
24+
`
25+
}))
26+
.add('With status', () => ({
27+
components: { Alert, AlertIcon },
28+
template: `
29+
<div>
30+
<Alert mb="3" status="error">
31+
<AlertIcon />
32+
There was an error processing your request
33+
</Alert>
34+
35+
<Alert mb="3" status="success">
36+
<AlertIcon />
37+
Data uploaded to the server. Fire on!
38+
</Alert>
39+
40+
<Alert mb="3" status="warning">
41+
<AlertIcon />
42+
Seems your account is about expire, upgrade now
43+
</Alert>
44+
45+
<Alert mb="3" status="info">
46+
<AlertIcon />
47+
Kiwi is going live on December 31st. Get ready!
48+
</Alert>
49+
</div>
50+
`
51+
}))
52+
.add('With composed description', () => ({
53+
components: { Alert, AlertIcon, AlertTitle, AlertDescription },
54+
template: `
55+
<div>
56+
<Alert
57+
status="success"
58+
variant="subtle"
59+
flexDirection="column"
60+
justifyContent="center"
61+
textAlign="center"
62+
height="200px"
63+
>
64+
<AlertIcon size="40px" mr="0" />
65+
<AlertTitle mt="4" mb="1" fontSize="lg">
66+
Event created!
67+
</AlertTitle>
68+
<AlertDescription maxWidth="sm">
69+
Your event has been successfully created. Our team will get back to you soon.
70+
</AlertDescription>
71+
</Alert>
72+
</div>
73+
`
74+
}))

0 commit comments

Comments
 (0)