import { action } from '@storybook/addon-actions'; import { ComponentStory, ComponentMeta } from '@storybook/react'; import styled from '@emotion/styled'; import Popover from 'components/Popover'; import { disableProps } from 'utils/storybookUtils'; const BodyWrapper = styled.div` text-align: center; padding: 24px 16px; user-select: none; `; const ChildWrapper = styled.div` width: 200px; border: 2px solid black; align-items: center; text-align: center; padding: 0px; user-select: none; `; export default { title: 'Experimental/Popover', component: Popover, argTypes: { place: { control: 'select', options: ['above', 'right', 'below', 'left', undefined], }, preferPlace: { control: 'select', options: ['above', 'right', 'below', 'left', undefined], }, ...disableProps(['className', 'appendTarget', 'body', 'style']), }, args: { isOpen: false, place: undefined, preferPlace: 'right', refreshIntervalMs: 0, enterExitTransitionDurationMs: 500, offset: 5, tipSize: 7, onOuterAction: action('onOuterAction'), }, parameters: { layout: 'centered', }, } as ComponentMeta; const Body = () => (

Popover Body

Click outside me to trigger onOuterAction
); const Child = () => (

Child Component

Resize window to show changes
); const PopoverTemplate: ComponentStory = args => ( }> ); export const Basic = PopoverTemplate.bind({});