import React from 'react'; import { Meta, Story } from '@storybook/react'; import Tooltip, { Props } from './Tooltip'; import './Tooltip.css'; const meta: Meta = { title: 'UI/Tooltip', component: Tooltip, argTypes: { disabled: { control: { type: 'boolean', }, }, }, parameters: { controls: { expanded: true }, }, }; export default meta; const Template: Story = args => (
); const TemplateRight: Story = args => (
); // By passing using the Args format for exported stories, you can control the props for a component for reuse in a test // https://storybook.js.org/docs/react/workflows/unit-testing export const Default = Template.bind({}); Default.args = { content: 'Here is some tooltip content', children: Hover me, }; export const WithJSXContent = Template.bind({}); WithJSXContent.args = { content: (

Here we have some JSX, useful for{' '} links , for example.

), children: Hover me, }; export const Disabled = Template.bind({}); Disabled.args = { content: 'Here is some tooltip content but I am disabled', children: Hover me, disabled: true, }; export const VisibleControlled = Template.bind({}); VisibleControlled.args = { content: 'Here is some tooltip content displayed by default as I am controlled', children: Hover me, visible: true, }; export const AlignLeft = TemplateRight.bind({}); AlignLeft.args = { content: 'Here is some tooltip content', children: Hover me, align: 'left', visible: true, }; export const AlignRight = Template.bind({}); AlignRight.args = { content: 'Here is some tooltip content', children: Hover me, align: 'right', visible: true, }; export const AlignTopLeft = TemplateRight.bind({}); AlignTopLeft.args = { content: 'Here is some tooltip content', children: Hover me, align: 'topLeft', visible: true, }; export const AlignTopRight = Template.bind({}); AlignTopRight.args = { content: 'Here is some tooltip content', children: Hover me, align: 'topRight', visible: true, };