Skip to content

Commit

Permalink
[SwipeableDrawer] Allow custom style (mui#11805)
Browse files Browse the repository at this point in the history
  • Loading branch information
Johann-S authored and oliviertassinari committed Jun 11, 2018
1 parent 0863bba commit 8ab1e4f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/material-ui/src/SwipeableDrawer/SwipeableDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ class SwipeableDrawer extends React.Component {
ModalProps: { BackdropProps, ...ModalPropsProp } = {},
onOpen,
open,
PaperProps,
PaperProps = {},
swipeAreaWidth,
variant,
...other
Expand All @@ -355,7 +355,10 @@ class SwipeableDrawer extends React.Component {
}}
PaperProps={{
...PaperProps,
style: { pointerEvents: variant === 'temporary' && !open ? 'none' : '' },
style: {
pointerEvents: variant === 'temporary' && !open ? 'none' : '',
...PaperProps.style,
},
ref: this.handlePaperRef,
}}
{...other}
Expand Down
15 changes: 15 additions & 0 deletions packages/material-ui/src/SwipeableDrawer/SwipeableDrawer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@ describe('<SwipeableDrawer />', () => {
wrapper.unmount();
});

it('should accept user custom style', () => {
const customStyle = { style: { backgroundColor: 'hotpink' } };
const wrapper = mount(
<SwipeableDrawerNaked
onOpen={() => {}}
onClose={() => {}}
open={false}
theme={createMuiTheme()}
PaperProps={customStyle}
/>,
);

assert.strictEqual(wrapper.props().PaperProps, customStyle);
});

describe('swipe to open', () => {
let wrapper;
let instance;
Expand Down

0 comments on commit 8ab1e4f

Please sign in to comment.