Skip to content

Commit

Permalink
Update default value of Popover spacing prop from 10px to 4px (#2479)
Browse files Browse the repository at this point in the history
* Update Popover default spacing from 10 to 4

* Changeset

* Update README and stories
  • Loading branch information
stephl3 committed Sep 16, 2024
1 parent 3ae5559 commit 58db7ae
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/two-pants-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@leafygreen-ui/popover': minor
---

Update default value of `spacing` prop from 10px to 4px
4 changes: 2 additions & 2 deletions packages/popover/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import Popover from '@leafygreen-ui/popover';
justify="start"
active={this.state.active}
usePortal={true}
spacing={10}
spacing={4}
>
<div className={popoverStyle}>Popover content</div>
</Popover>
Expand Down Expand Up @@ -65,7 +65,7 @@ The popover component will be automatically positioned relative to its nearest p
| `align` | `'top'` \| `'bottom'` \| `'left'` \| `'right'` \| `'center-horizontal'` \| `'center-vertical'` | A string that determines the alignment of the popover relative to the `refEl`. | `'bottom'` |
| `justify` | `'start'` \| `'middle'` \| `'end'` \| `'fit'` | A string that determines the justification of the popover relative to the `refEl`. Justification will be defined relative to the `align` prop | `'start'` |
| `children` | `node` | Content that will appear inside of the `<Popover />` component | |
| `spacing` | `number` | Specifies the amount of spacing (in pixels) between the trigger element and the content element. | `10` |
| `spacing` | `number` | Specifies the amount of spacing (in pixels) between the trigger element and the content element. | `4` |
| `className` | `string` | Classname to apply to popover-content container | |
| `adjustOnMutation` | `boolean` | Should the Popover auto adjust its content when the DOM changes (using MutationObserver). | `false` |
| `onClick` | `function` | Function that will be called when popover content is clicked. | |
Expand Down
2 changes: 1 addition & 1 deletion packages/popover/src/Popover.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const meta: StoryMetaType<typeof Popover> = {
args: {
align: Align.Top,
justify: Justify.Start,
spacing: 10,
spacing: 4,
adjustOnMutation: false,
buttonText: 'Button Text',
},
Expand Down
2 changes: 1 addition & 1 deletion packages/popover/src/Popover.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export type PopoverProps = {
/**
* Specifies the amount of spacing (in pixels) between the trigger element and the Popover content.
*
* default: `10`
* default: `4`
*/
spacing?: number;

Expand Down
3 changes: 2 additions & 1 deletion packages/popover/src/Popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useMergeRefs } from '@leafygreen-ui/hooks';
import { usePopoverContext } from '@leafygreen-ui/leafygreen-provider';
import { consoleOnce } from '@leafygreen-ui/lib';
import Portal from '@leafygreen-ui/portal';
import { spacing as spacingToken } from '@leafygreen-ui/tokens';

import { useContentNode, useReferenceElement } from '../Popover.hooks';
import {
Expand Down Expand Up @@ -56,7 +57,7 @@ export const Popover = forwardRef<HTMLDivElement, PopoverComponentProps>(
(
{
active = false,
spacing = 10,
spacing = spacingToken[100],
align = Align.Bottom,
justify = Justify.Start,
adjustOnMutation = false,
Expand Down

0 comments on commit 58db7ae

Please sign in to comment.