From 756ecf509bee2b6440f583b43394577334b49618 Mon Sep 17 00:00:00 2001 From: Daniel Almaguer Date: Tue, 1 Sep 2020 10:18:35 -0500 Subject: [PATCH 1/2] feat(component): rename popover offset props and defaults --- .../big-design/src/components/Popover/Popover.tsx | 12 ++++++------ .../big-design/src/components/Tooltip/Tooltip.tsx | 2 +- packages/docs/PropTables/PopoverPropTable.tsx | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/big-design/src/components/Popover/Popover.tsx b/packages/big-design/src/components/Popover/Popover.tsx index c6c3ffb50..1dab9e392 100644 --- a/packages/big-design/src/components/Popover/Popover.tsx +++ b/packages/big-design/src/components/Popover/Popover.tsx @@ -19,8 +19,8 @@ export interface PopoverProps extends BoxPropsWithoutMargins { isOpen: boolean; label: string; matchAnchorElementWidth?: boolean; - offsetX?: number; - offsetY?: number; + skidding?: number; + distance?: number; onClose?(): void; placement?: Placement; } @@ -58,8 +58,8 @@ const InternalPopover: React.FC = ({ id, label, matchAnchorElementWidth = false, - offsetX = 0, - offsetY = 0, + skidding = 0, + distance = 4, onClose = () => null, placement = 'auto', role, @@ -73,7 +73,7 @@ const InternalPopover: React.FC = ({ { name: 'offset', options: { - offset: [offsetX, offsetY], + offset: [skidding, distance], }, }, { @@ -93,7 +93,7 @@ const InternalPopover: React.FC = ({ }, } as Modifier, ], - [offsetX, offsetY, matchAnchorElementWidth], + [skidding, distance, matchAnchorElementWidth], ); const { styles, attributes } = usePopper(anchorElement, popperElement, { diff --git a/packages/big-design/src/components/Tooltip/Tooltip.tsx b/packages/big-design/src/components/Tooltip/Tooltip.tsx index 235473f6b..f1c5f89d6 100644 --- a/packages/big-design/src/components/Tooltip/Tooltip.tsx +++ b/packages/big-design/src/components/Tooltip/Tooltip.tsx @@ -22,7 +22,7 @@ export const Tooltip: React.FC = memo(({ children, inline = true, return [ { name: 'eventListeners', options: { scroll: isVisible, resize: isVisible } }, - { name: 'offset', options: { offset: [0, 8] } }, + { name: 'offset', options: { offset: [0, 4] } }, ...mods, ]; }, [isVisible, modifiers]); diff --git a/packages/docs/PropTables/PopoverPropTable.tsx b/packages/docs/PropTables/PopoverPropTable.tsx index 5c240d215..0d15c41a8 100644 --- a/packages/docs/PropTables/PopoverPropTable.tsx +++ b/packages/docs/PropTables/PopoverPropTable.tsx @@ -48,16 +48,16 @@ const popoverProps: Prop[] = [ description: 'If set to true, the Popover will have the same width as its anchor element.', }, { - name: 'offsetX', + name: 'skidding', types: 'number', defaultValue: '0', - description: 'Determines the popover offset on the X axis.', + description: 'Determines the offset along the anchorElement.', }, { name: 'offsetY', types: 'number', - defaultValue: '0', - description: 'Determines the popover offset on the Y axis.', + defaultValue: '4', + description: 'Determines the offset away from the anchorElement.', }, { name: 'onClose', From eafd5edadc3019b1374448a64195963e8aabc91c Mon Sep 17 00:00:00 2001 From: Daniel Almaguer Date: Tue, 1 Sep 2020 10:51:46 -0500 Subject: [PATCH 2/2] Update PopoverPropTable.tsx --- packages/docs/PropTables/PopoverPropTable.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/docs/PropTables/PopoverPropTable.tsx b/packages/docs/PropTables/PopoverPropTable.tsx index 0d15c41a8..e3463cc72 100644 --- a/packages/docs/PropTables/PopoverPropTable.tsx +++ b/packages/docs/PropTables/PopoverPropTable.tsx @@ -54,7 +54,7 @@ const popoverProps: Prop[] = [ description: 'Determines the offset along the anchorElement.', }, { - name: 'offsetY', + name: 'distance', types: 'number', defaultValue: '4', description: 'Determines the offset away from the anchorElement.',