|
|
|
@ -2,7 +2,7 @@ import { action } from '@storybook/addon-actions'; |
|
|
|
|
import { StoryFn, Meta } from '@storybook/react'; |
|
|
|
|
import React from 'react'; |
|
|
|
|
|
|
|
|
|
import { Alert, AlertVariant, VerticalGroup } from '@grafana/ui'; |
|
|
|
|
import { Alert, AlertVariant, Stack } from '@grafana/ui'; |
|
|
|
|
|
|
|
|
|
import { StoryExample } from '../../utils/storybook/StoryExample'; |
|
|
|
|
|
|
|
|
@ -29,11 +29,7 @@ const meta: Meta = { |
|
|
|
|
export const Basic: StoryFn<typeof Alert> = (args) => { |
|
|
|
|
return ( |
|
|
|
|
<div> |
|
|
|
|
<Alert {...args}> |
|
|
|
|
<VerticalGroup> |
|
|
|
|
<div>Child content that includes some alert details, like maybe what actually happened.</div> |
|
|
|
|
</VerticalGroup> |
|
|
|
|
</Alert> |
|
|
|
|
<Alert {...args}>Child content that includes some alert details, like maybe what actually happened.</Alert> |
|
|
|
|
</div> |
|
|
|
|
); |
|
|
|
|
}; |
|
|
|
@ -44,13 +40,7 @@ Basic.args = { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export const WithActions: StoryFn<typeof Alert> = (args) => { |
|
|
|
|
return ( |
|
|
|
|
<Alert {...args}> |
|
|
|
|
<VerticalGroup> |
|
|
|
|
<div>Child content that includes some alert details, like maybe what actually happened.</div> |
|
|
|
|
</VerticalGroup> |
|
|
|
|
</Alert> |
|
|
|
|
); |
|
|
|
|
return <Alert {...args}>Child content that includes some alert details, like maybe what actually happened.</Alert>; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
WithActions.args = { |
|
|
|
@ -62,7 +52,7 @@ WithActions.args = { |
|
|
|
|
|
|
|
|
|
export const Examples: StoryFn<typeof Alert> = () => { |
|
|
|
|
return ( |
|
|
|
|
<VerticalGroup> |
|
|
|
|
<Stack direction="column"> |
|
|
|
|
<StoryExample name="With buttonContent and children"> |
|
|
|
|
<Alert |
|
|
|
|
title={'The title of the alert'} |
|
|
|
@ -77,15 +67,15 @@ export const Examples: StoryFn<typeof Alert> = () => { |
|
|
|
|
<Alert title={'No dismiss'} severity={'success'} /> |
|
|
|
|
</StoryExample> |
|
|
|
|
<StoryExample name="Severities"> |
|
|
|
|
<VerticalGroup> |
|
|
|
|
<Stack direction="column"> |
|
|
|
|
{severities.map((severity) => ( |
|
|
|
|
<Alert title={`Severity: ${severity}`} severity={severity} key={severity}> |
|
|
|
|
Child content |
|
|
|
|
</Alert> |
|
|
|
|
))} |
|
|
|
|
</VerticalGroup> |
|
|
|
|
</Stack> |
|
|
|
|
</StoryExample> |
|
|
|
|
</VerticalGroup> |
|
|
|
|
</Stack> |
|
|
|
|
); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|