Skip to content

Commit

Permalink
feat(Dropdown): add popperjs modifiers to the props
Browse files Browse the repository at this point in the history
  • Loading branch information
ej9x committed Jan 17, 2019
1 parent 852d6a8 commit a3b4c09
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/Dropdown/DropdownBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ type DropdownBodyProps = {
/** When true then close dropdown on outside clicking */
closeOnClickOutside?: boolean,

/** */
modifiers?: Object,
/** Options for background color */
background?: 'white' | 'dark' | 'none',
/** Options for body padding */
Expand All @@ -50,8 +52,10 @@ const setOffset = (offset?: PropSizes) => offset && offset !== 'none'
: fp.identity;

const setFlip = fp.merge({
flip: { behavior: ['bottom'] },
boundariesElement: 'window',
flip: {
behavior: ['bottom'],
boundariesElement: 'viewport',
},
});

const dropdownBodyEnhancer: HOC<*, DropdownBodyProps> = compose(
Expand Down Expand Up @@ -94,12 +98,13 @@ const DropdownBody = dropdownBodyEnhancer(
}

getPopperModifiers = () => {
const { preventOverflow, offset } = this.props;
const { preventOverflow, offset, modifiers } = this.props;

return fp.pipe(
setFlip,
setPreventOverflow(preventOverflow),
setOffset(offset),
fp.merge(modifiers),
)({});
}

Expand Down

0 comments on commit a3b4c09

Please sign in to comment.