Skip to content

Commit

Permalink
feat: popover stories
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Mar 9, 2020
1 parent c827be8 commit 6dc7ee2
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions ui/components/src/Popover/Popover.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import React from 'react';
import { Box, Button, Donut } from 'theme-ui';
import { Popover, PopoverProps } from './Popover';

export default {
title: 'Components/Popover',
component: Popover,
};

export const simple = ({ placement, trigger }: PopoverProps) => {
const [isOpen, setIsOpen] = React.useState(false);
return (
<Popover
trigger={trigger}
placement={placement}
tooltipShown={isOpen}
onVisibilityChange={isVisible => {
setIsOpen(isVisible);
}}
tooltip={() => (
<Box>
<Donut value={1 / 2} />
</Box>
)}
>
<Button variant="secondary">Click to open</Button>
</Popover>
);
};

simple.story = {
parameters: {
controls: {
placement: {
type: 'options',
options: [
'auto-start',
'auto',
'auto-end',
'top-start',
'top',
'top-end',
'right-start',
'right',
'right-end',
'bottom-end',
'bottom',
'bottom-start',
'left-end',
'left',
'left-start',
],
value: 'bottom',
},
trigger: {
type: 'options',
options: ['none', 'click', 'right-click', 'hover', 'focus'],
value: 'click',
},
},
},
};

0 comments on commit 6dc7ee2

Please sign in to comment.