Skip to content

Commit

Permalink
chore(Tooltip): restrict placement types to design values (#1941)
Browse files Browse the repository at this point in the history
- now placement can be top, right, bottom, left, or auto
- add additional constraints to the component storybook for clarity
  • Loading branch information
booc0mtaco authored May 14, 2024
1 parent 1e431b4 commit 5469b18
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
14 changes: 12 additions & 2 deletions src/components/Tooltip/Tooltip-v2.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,19 @@ export default {
type: null,
},
},
placement: {
visible: {
table: {
defaultValue: { summary: 'top' },
disable: true,
},
},
delay: {
control: {
type: 'number',
},
},
reference: {
control: {
type: null,
},
},
},
Expand Down
9 changes: 6 additions & 3 deletions src/components/Tooltip/Tooltip-v2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,12 @@ type TooltipProps = {
* Where the tooltip should be placed in relation to the element it's attached to.
* See: https://atomiks.github.io/tippyjs/v6/all-props/#placement
*
* **Default is `"top"`**.
* **Default is `"auto"`**.
*/
placement?: TippyProps['placement'];
placement?: Extract<
TippyProps['placement'],
'auto' | 'top' | 'right' | 'bottom' | 'left'
>;
/**
* The content of the tooltip bubble.
*/
Expand All @@ -101,7 +104,7 @@ export const Tooltip = ({
childNotInteractive,
className,
duration = 200,
placement = 'top',
placement = 'auto',
text,
...rest
}: TooltipProps) => {
Expand Down

0 comments on commit 5469b18

Please sign in to comment.