update story
This commit is contained in:
parent
fa4fec34e4
commit
9b6e389da1
1 changed files with 7 additions and 13 deletions
|
@ -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>
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue