Skip to content

Commit 4aa80ac

Browse files
roshni73frozenhelium
authored andcommitted
Add Stories for alert component
1 parent e709f20 commit 4aa80ac

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import type {
2+
Meta,
3+
StoryObj,
4+
} from '@storybook/react';
5+
6+
import Alert from './Alert';
7+
8+
const meta = {
9+
title: 'Components/Alert',
10+
component: Alert,
11+
parameters: {
12+
layout: 'centered',
13+
allowfullscreen: true,
14+
},
15+
tags: ['autodocs'],
16+
argTypes: {},
17+
} satisfies Meta<typeof Alert>;
18+
19+
export default meta;
20+
type Story = StoryObj<typeof meta>;
21+
22+
export const Info: Story = {
23+
args: {
24+
name: 'info',
25+
title: 'Information',
26+
type: 'info',
27+
},
28+
};
29+
30+
export const Success: Story = {
31+
args: {
32+
name: 'success',
33+
title: 'Success',
34+
type: 'success',
35+
},
36+
};
37+
38+
export const Warning : Story = {
39+
args: {
40+
name: 'warning',
41+
title: 'Warning',
42+
type: 'warning',
43+
},
44+
};
45+
46+
export const Danger : Story = {
47+
args: {
48+
name: 'danger',
49+
title: 'Danger',
50+
type: 'danger',
51+
},
52+
};
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import {
2+
Alert as PureAlert,
3+
AlertProps as PureAlertProps,
4+
} from '@ifrc-go/ui';
5+
6+
interface AlertProps<N extends string> extends PureAlertProps<N> {}
7+
8+
function WrappedAlert<N extends string>(props: AlertProps<N>) {
9+
return (
10+
<PureAlert {...props} />// eslint-disable-line react/jsx-props-no-spreading
11+
);
12+
}
13+
14+
export default WrappedAlert;

0 commit comments

Comments
 (0)