2020-08-07 13:44:34 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { AlertVariant, Button } from '@patternfly/react-core';
|
|
|
|
import { storiesOf } from '@storybook/react';
|
|
|
|
|
|
|
|
import { AlertPanel } from '../src/components/alert/AlertPanel';
|
2020-08-20 13:46:21 +00:00
|
|
|
import { useAlerts } from '../src/components/alert/Alerts';
|
2020-08-07 13:44:34 +00:00
|
|
|
|
2020-08-20 13:46:21 +00:00
|
|
|
storiesOf('Alert Panel')
|
2020-08-07 13:44:34 +00:00
|
|
|
.add('api', () => <AlertPanel alerts={[{ key: 1, message: 'Hello', variant: AlertVariant.default }]} onCloseAlert={() => { }} />)
|
|
|
|
.add('add alert', () => {
|
2020-08-20 13:46:21 +00:00
|
|
|
const [add, alerts, hide] = useAlerts();
|
2020-08-07 13:44:34 +00:00
|
|
|
return (
|
2020-08-20 13:46:21 +00:00
|
|
|
<>
|
|
|
|
<AlertPanel alerts={alerts} onCloseAlert={hide} />
|
|
|
|
<Button onClick={() => add('Hello', AlertVariant.default)}>Add</Button>
|
|
|
|
</>
|
2020-08-07 13:44:34 +00:00
|
|
|
);
|
|
|
|
});
|