|
| 1 | +import { Meta, StoryObj } from '@storybook/react'; |
| 2 | +import Tooltip, { TooltipProps } from './Tooltip'; |
| 3 | +import { Text } from '../../atoms/Text/Text'; |
| 4 | +import Button from '../../atoms/Button/Button'; |
| 5 | + |
| 6 | +const meta: Meta<typeof Tooltip> = { |
| 7 | + title: 'Components/Molecules/Tooltip', |
| 8 | + component: Tooltip, |
| 9 | + parameters: { |
| 10 | + layout: 'centered', |
| 11 | + }, |
| 12 | + argTypes: { |
| 13 | + position: { |
| 14 | + control: { |
| 15 | + type: 'select', |
| 16 | + options: ['top', 'right', 'bottom', 'left'], |
| 17 | + }, |
| 18 | + }, |
| 19 | + }, |
| 20 | + decorators: [ |
| 21 | + (Story) => ( |
| 22 | + <div style={{ minHeight: '100vh', display: 'flex', alignItems: 'center', justifyContent: 'center' }}> |
| 23 | + <Story /> |
| 24 | + </div> |
| 25 | + ), |
| 26 | + ], |
| 27 | + tags: ['autodocs'], |
| 28 | +}; |
| 29 | + |
| 30 | +export default meta; |
| 31 | +type TooltipStory = StoryObj<TooltipProps>; |
| 32 | + |
| 33 | +export const Top: TooltipStory = (args: any) => ( |
| 34 | + <Tooltip {...args} className='bg-green-500 text-white w-[200px] max-h-[200px]' content={ |
| 35 | + <> |
| 36 | + <Text size="sm">This is some description text in the tooltip.</Text> |
| 37 | + </> |
| 38 | + }> |
| 39 | + <Button label={'Hover me'} className="bg-blue-500 hover:bg-blue-600 text-white mb-4" /> |
| 40 | + </Tooltip> |
| 41 | +); |
| 42 | + |
| 43 | +Top.args = { |
| 44 | + position: 'top', |
| 45 | +}; |
| 46 | + |
| 47 | +export const Right: TooltipStory = (args: any) => ( |
| 48 | + <Tooltip {...args} content={ |
| 49 | + <> |
| 50 | + <Text size="base" weight="bold" className="mb-2">Tooltip Title</Text> |
| 51 | + <Text size="sm">This is some description text in the tooltip.</Text> |
| 52 | + <Button variant="solid" size="sm" backgroundColor="#4CAF50" label="Click Me" className="mt-2" /> |
| 53 | + </> |
| 54 | + }> |
| 55 | + <Button label={'Hover me'} className="bg-blue-500 hover:bg-blue-600 text-white mb-4" /> |
| 56 | + </Tooltip> |
| 57 | +); |
| 58 | + |
| 59 | +Right.args = { |
| 60 | + position: 'right', |
| 61 | +}; |
| 62 | + |
| 63 | +export const Bottom: TooltipStory = (args: any) => ( |
| 64 | + <Tooltip {...args} content={ |
| 65 | + <> |
| 66 | + <Text size="base" weight="bold" className="mb-2">Tooltip Title</Text> |
| 67 | + <Text size="sm">This is some description text in the tooltip.</Text> |
| 68 | + <Button variant="solid" size="sm" backgroundColor="#4CAF50" label="Click Me" className="mt-2" /> |
| 69 | + </> |
| 70 | + }> |
| 71 | + <Button label={'Hover me'} className="bg-blue-500 hover:bg-blue-600 text-white mb-4" /> |
| 72 | + </Tooltip> |
| 73 | +); |
| 74 | + |
| 75 | +Bottom.args = { |
| 76 | + position: 'bottom', |
| 77 | +}; |
| 78 | + |
| 79 | +export const Left: TooltipStory = (args: any) => ( |
| 80 | + <Tooltip {...args} content={ |
| 81 | + <> |
| 82 | + <Text size="base" weight="bold" className="mb-2">Tooltip Title</Text> |
| 83 | + <Text size="sm">This is some description text in the tooltip.</Text> |
| 84 | + <Button variant="solid" size="sm" backgroundColor="#4CAF50" label="Click Me" className="mt-2" /> |
| 85 | + </> |
| 86 | + }> |
| 87 | + <Button label={'Hover me'} className="bg-blue-500 hover:bg-blue-600 text-white mb-4" /> |
| 88 | + </Tooltip> |
| 89 | +); |
| 90 | + |
| 91 | +Left.args = { |
| 92 | + position: 'left', |
| 93 | +}; |
0 commit comments