ToolTip: refactors story from knobs to control (#33130)

This commit is contained in:
Uchechukwu Obasi 2021-04-20 09:23:59 +01:00 committed by GitHub
parent 025b671146
commit bebc48c1f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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',
};