Skip to content

Commit 4a0e95e

Browse files
committed
stories: add stories for tooltips and toast alerts
1 parent 0902c08 commit 4a0e95e

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from 'react';
2+
import { useStore } from 'store';
3+
import AlertContainer from 'components/common/AlertContainer';
4+
import { Button } from 'components/common/base';
5+
6+
export default {
7+
title: 'Components/Alerts',
8+
component: AlertContainer,
9+
parameters: { centered: true },
10+
};
11+
12+
export const Default = () => {
13+
const store = useStore();
14+
const handleClick = () => {
15+
store.uiStore.notify(
16+
'This is a sample message to be displayed inside of a toast alert',
17+
'Sample Alert Title',
18+
);
19+
};
20+
21+
return (
22+
<>
23+
<Button onClick={handleClick}>Show Alert</Button>
24+
<AlertContainer />
25+
</>
26+
);
27+
};

app/src/__stories__/Tip.stories.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React from 'react';
2+
import Tip from 'components/common/Tip';
3+
4+
export default {
5+
title: 'Components/Tooltip',
6+
component: Tip,
7+
parameters: { contained: true },
8+
};
9+
10+
const placements = [
11+
'top',
12+
'topRight',
13+
'right',
14+
'bottomRight',
15+
'bottom',
16+
'bottomLeft',
17+
'left',
18+
'topLeft',
19+
];
20+
21+
export const Placements = () => {
22+
return (
23+
<div style={{ textAlign: 'center', marginTop: 300 }}>
24+
{placements.map(p => (
25+
<Tip key={p} placement={p} overlay="Tip of the day">
26+
<span style={{ margin: 10 }}>{p}</span>
27+
</Tip>
28+
))}
29+
</div>
30+
);
31+
};

0 commit comments

Comments
 (0)