Skip to content

Commit

Permalink
docs: improve popover
Browse files Browse the repository at this point in the history
  • Loading branch information
rabelloo committed Oct 14, 2021
1 parent eaedb28 commit e674159
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
8 changes: 8 additions & 0 deletions packages/react/src/components/popover/popover-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ export interface PopoverProps extends BaseProps, Omit<Div, 'ref'> {
* screen is too small.
*/
overlay?: boolean;
/**
* An event that notifies the intention to close the Popover, usually from an
* outside click.
*/
onClose?: () => void;
/**
* An event that notifies the initial rendering of the Popover has completed,
* provides the Popover element as argument.
*/
onRender?: (popover: HTMLDivElement | null) => void;
/**
* Ref to an element which the Popover should target for placement.
Expand Down
20 changes: 11 additions & 9 deletions packages/react/src/components/popover/popover.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Button, Popover, PopoverProps } from '@onfido/castor-react';
import React, { Fragment, useRef } from 'react';
import {
Meta,
omit,
optionsToSummary,
reactMatrix,
Story,
Expand All @@ -15,7 +14,13 @@ export default {
title: 'React/Popover',
component: Popover,
argTypes: {
...omit('onClose', 'target'),
withPortal: {
description: [
'Toggle between an example with and without `target` ref.',
'Specific to `react-dom`.',
].join('\n\n'),
name: '[Story only] with portal',
},
align: {
control: { type: 'inline-radio', options: align },
table: {
Expand All @@ -34,13 +39,10 @@ export default {
type: { summary: optionsToSummary(position) },
},
},
withPortal: {
description: [
'Toggle between an example with and without `target` ref.',
'Specific to `react-dom`.',
].join('\n\n'),
name: '[Story only] with portal',
},
overlay: { control: null },
onClose: {},
onRender: {},
target: { control: null },
},
args: {
children: 'Popover content',
Expand Down
14 changes: 7 additions & 7 deletions packages/react/src/components/tooltip/tooltip.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ export default {
title: 'React/Tooltip',
component: Tooltip,
argTypes: {
withPortal: {
description: [
'Toggle between an example with and without `target` ref.',
'Specific to `react-dom`.',
].join('\n\n'),
name: '[Story only] with portal',
},
align: {
control: { type: 'inline-radio', options: align },
table: {
Expand All @@ -38,13 +45,6 @@ export default {
table: { type: { summary: 'boolean | "on-hover"' } },
},
target: { control: { disable: true } },
withPortal: {
description: [
'Toggle between an example with and without `target` ref.',
'Specific to `react-dom`.',
].join('\n\n'),
name: '[Story only] with portal',
},
},
args: {
children: 'Tooltip',
Expand Down

0 comments on commit e674159

Please sign in to comment.