mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 01:53:33 -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 { select } from '@storybook/addon-knobs';
|
||||
import { Story } from '@storybook/react';
|
||||
import { Tooltip } from './Tooltip';
|
||||
import { withCenteredStory } from '../../utils/storybook/withCenteredStory';
|
||||
import { Button } from '../Button';
|
||||
@ -13,16 +13,57 @@ export default {
|
||||
docs: {
|
||||
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 = () => {
|
||||
const VISUAL_GROUP = 'Visual options';
|
||||
// ---
|
||||
const theme = select('Theme', ['info', 'error', 'info-alt'], 'info', VISUAL_GROUP);
|
||||
export const Basic: Story = ({ content, ...args }) => {
|
||||
return (
|
||||
<Tooltip content="This is a tooltip" theme={theme}>
|
||||
<Tooltip content={content} {...args}>
|
||||
<Button>Hover me for Tooltip </Button>
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
Basic.args = {
|
||||
content: 'This is a tooltip',
|
||||
theme: 'info',
|
||||
show: true,
|
||||
placement: 'auto',
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user