-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[SwipeableDrawer] Allow custom style #11805
Conversation
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.
Nice first contribution! 👍
pointerEvents: variant === 'temporary' && !open ? 'none' : '', | ||
}; | ||
|
||
if (PaperProps && PaperProps.style) { |
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.
PaperProps
will never be undefined, only the PaperProps.style
check is needed here. Also, destructuring null
or undefined
is perfectly fine. This could be simplified (and inlined) to
style: { ...PaperProps.style, pointerEvents: variant === 'temporary' && !open ? 'none' : '' }
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.
I tested locally on the documentation and I had a PaperProps
undefined that's but I'll double check that thanks 👍
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.
This should do it:
- PaperProps,
+ PaperProps = {},
swipeAreaWidth,
variant,
...other
} = this.props;
// ...
PaperProps={{
...PaperProps,
+ style: {
+ pointerEvents: variant === 'temporary' && !open ? 'none' : '',
+ ...PaperProps.style,
+ }
/>, | ||
); | ||
|
||
assert.strictEqual(customStyle, wrapper.prop('PaperProps')); |
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.
Just for consistency with the codebase.
.prop('PaperProps') <> .props().PaperProps
pointerEvents: variant === 'temporary' && !open ? 'none' : '', | ||
}; | ||
|
||
if (PaperProps && PaperProps.style) { |
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.
This should do it:
- PaperProps,
+ PaperProps = {},
swipeAreaWidth,
variant,
...other
} = this.props;
// ...
PaperProps={{
...PaperProps,
+ style: {
+ pointerEvents: variant === 'temporary' && !open ? 'none' : '',
+ ...PaperProps.style,
+ }
@Johann-S It's a great first pull request on Material-UI 👌🏻. Thank you for giving it a shot! |
That's nothing 😊 and it's pretty easy to contribute to your project thanks to the different hint you gave 😉 |
I hope I followed all your contributing guidelines 😄
Fixes: #11799