update story

This commit is contained in:
Erik Jan de Wit 2020-08-20 15:46:21 +02:00
parent fa4fec34e4
commit 9b6e389da1

View file

@ -3,22 +3,16 @@ import { AlertVariant, Button } from '@patternfly/react-core';
import { storiesOf } from '@storybook/react';
import { AlertPanel } from '../src/components/alert/AlertPanel';
import { withAlerts, useAlerts } from '../src/components/alert/Alerts';
import { useAlerts } from '../src/components/alert/Alerts';
storiesOf('Alert Panel', module)
storiesOf('Alert Panel')
.add('api', () => <AlertPanel alerts={[{ key: 1, message: 'Hello', variant: AlertVariant.default }]} onCloseAlert={() => { }} />)
.add('add alert', () => {
const Comp = () => {
const [alerts, add, hide] = useAlerts();
return (
<>
<AlertPanel alerts={alerts} onCloseAlert={hide} />
<Button onClick={() => add('Hello', AlertVariant.default)}>Add</Button>
</>
);
}
const WrapperComponent = withAlerts(Comp);
const [add, alerts, hide] = useAlerts();
return (
<WrapperComponent/>
<>
<AlertPanel alerts={alerts} onCloseAlert={hide} />
<Button onClick={() => add('Hello', AlertVariant.default)}>Add</Button>
</>
);
});