-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pass Popper modifiers to DropdownMenu #929
pass Popper modifiers to DropdownMenu #929
Conversation
src/DropdownMenu.js
Outdated
attrs.modifiers = !flip ? noFlipModifier : undefined; | ||
attrs.modifiers = !flip ? { | ||
...noFlipModifier, | ||
...modifiers, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want no-flip ... should we reverse the order here? That way if one specifies as such:
flip={false} modifiers={{flip:{enabled:true}}}
The flip will win out on the modifiers. Rare case, just trying to think which should win?
Looks like one of the tests broke as well. Will need an additional test as well to test different modifier situations ... and handle the expected case for: |
reverse the order should fix this case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update the docs to add the new prop. Also this needs a few new tests, nothing major.
Take a look at #710
src/DropdownMenu.js
Outdated
className: PropTypes.string, | ||
cssModule: PropTypes.object, | ||
}; | ||
|
||
const defaultProps = { | ||
tag: 'div', | ||
flip: true, | ||
modifiers: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need a default, undefined is fine, even with the spread operator.
src/__tests__/DropdownMenu.spec.js
Outdated
@@ -157,7 +157,7 @@ describe('DropdownMenu', () => { | |||
} | |||
); | |||
|
|||
expect(wrapper.find(Popper).prop('modifiers')).toBe(undefined); | |||
expect(wrapper.find(Popper).prop('modifiers')).toEqual({}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without the default prop setting it to and object, this should be able to be reverted
i don't know why, but i can't start project on local env, something wrong with
yes, i know, i have used old version of node.js))) and missed two packages on devDependencies |
localhost vs 127.0.0.1? IIRC webpack dev server checks the host header and will not serve content if it doesn't match the settings. |
docs/lib/Components/DropdownsPage.js
Outdated
<div className="docs-example"> | ||
<Row> | ||
<Col> | ||
<Dropdown> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need isOpen
and toggle
props, or you can use UncontrolledDropdown
here (and just keep Dropdown
with some dummy isOpen
and toggle
props in the raw example code which is displayed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omg, okay)
No description provided.