mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
ToolTip: refactors story from knobs to control (#33130)
This commit is contained in:
parent
025b671146
commit
bebc48c1f6
@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { select } from '@storybook/addon-knobs';
|
import { Story } from '@storybook/react';
|
||||||
import { Tooltip } from './Tooltip';
|
import { Tooltip } from './Tooltip';
|
||||||
import { withCenteredStory } from '../../utils/storybook/withCenteredStory';
|
import { withCenteredStory } from '../../utils/storybook/withCenteredStory';
|
||||||
import { Button } from '../Button';
|
import { Button } from '../Button';
|
||||||
@ -13,16 +13,57 @@ export default {
|
|||||||
docs: {
|
docs: {
|
||||||
page: mdx,
|
page: mdx,
|
||||||
},
|
},
|
||||||
|
knobs: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
argTypes: {
|
||||||
|
content: {
|
||||||
|
control: {
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
theme: {
|
||||||
|
control: {
|
||||||
|
type: 'select',
|
||||||
|
options: ['info', 'error'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
placement: {
|
||||||
|
control: {
|
||||||
|
type: 'select',
|
||||||
|
options: [
|
||||||
|
'auto',
|
||||||
|
'bottom',
|
||||||
|
'top',
|
||||||
|
'auto-start',
|
||||||
|
'auto-end',
|
||||||
|
'right',
|
||||||
|
'left',
|
||||||
|
'top-start',
|
||||||
|
'top-end',
|
||||||
|
'bottom-start',
|
||||||
|
'bottom-end',
|
||||||
|
'right-start',
|
||||||
|
'right-end',
|
||||||
|
'left-start',
|
||||||
|
'left-end',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const basic = () => {
|
export const Basic: Story = ({ content, ...args }) => {
|
||||||
const VISUAL_GROUP = 'Visual options';
|
|
||||||
// ---
|
|
||||||
const theme = select('Theme', ['info', 'error', 'info-alt'], 'info', VISUAL_GROUP);
|
|
||||||
return (
|
return (
|
||||||
<Tooltip content="This is a tooltip" theme={theme}>
|
<Tooltip content={content} {...args}>
|
||||||
<Button>Hover me for Tooltip </Button>
|
<Button>Hover me for Tooltip </Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Basic.args = {
|
||||||
|
content: 'This is a tooltip',
|
||||||
|
theme: 'info',
|
||||||
|
show: true,
|
||||||
|
placement: 'auto',
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user