[SwipeableDrawer] Allow custom style#11805
[SwipeableDrawer] Allow custom style#11805oliviertassinari merged 1 commit intomui:masterfrom Johann-S:fix-paper-propes-style
Conversation
| pointerEvents: variant === 'temporary' && !open ? 'none' : '', | ||
| }; | ||
|
|
||
| if (PaperProps && PaperProps.style) { |
There was a problem hiding this comment.
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.
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.
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.
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.
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