From 27dd578e4a1a6daef026c2e459128dd53e76866c Mon Sep 17 00:00:00 2001 From: tamarasaurus Date: Fri, 17 Apr 2020 15:32:27 +0200 Subject: [PATCH] Update Dropdown to support passing in modifiers Update Dropdown to support passing in modifiers --- packages/react/src/components/Dropdown/index.js | 4 ++++ .../react/src/components/Dropdown/index.stories.js | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/packages/react/src/components/Dropdown/index.js b/packages/react/src/components/Dropdown/index.js index c5f19102..e4c68844 100644 --- a/packages/react/src/components/Dropdown/index.js +++ b/packages/react/src/components/Dropdown/index.js @@ -14,6 +14,7 @@ const Dropdown = ({ triggerer, placement, portalNode, + modifiers, }) => { const [isOpen, setIsOpen] = React.useState(isOpenProp); @@ -84,6 +85,7 @@ const Dropdown = ({ offset: { offset: '0, 4px', }, + ...modifiers, }} innerRef={setPopperNode} placement={placement} @@ -105,6 +107,7 @@ Dropdown.propTypes = { triggerer: PropTypes.func.isRequired, placement: PropTypes.string, // https://popper.js.org/docs/v1/#Popper.placements portalNode: PropTypes.instanceOf(HTMLElement), + modifiers: PropTypes.shape({}), // https://popper.js.org/docs/v1/#modifiers }; Dropdown.defaultProps = { @@ -114,6 +117,7 @@ Dropdown.defaultProps = { onOpen: () => {}, placement: 'bottom-end', portalNode: null, + modifiers: {}, }; export default Dropdown; diff --git a/packages/react/src/components/Dropdown/index.stories.js b/packages/react/src/components/Dropdown/index.stories.js index b782d278..1de5b707 100644 --- a/packages/react/src/components/Dropdown/index.stories.js +++ b/packages/react/src/components/Dropdown/index.stories.js @@ -70,5 +70,17 @@ stories.add('Playground', () => ( + + With modifiers + + + ));