keycloak-scim/stories/5-AlertPanel.stories.js

25 lines
835 B
JavaScript
Raw Normal View History

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';
import { withAlerts, useAlerts } from '../src/components/alert/Alerts';
storiesOf('Alert Panel', module)
.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);
return (
<WrapperComponent/>
);
});