Skip to content

Commit 5848294

Browse files
authored
refactor: remove contentWrapperStyle, use styles.wrapper instead (#439)
1 parent 570e77b commit 5848294

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ ReactDom.render(
4444
| props | type | default | description |
4545
|------------|----------------|---------|----------------|
4646
| className | string | null | - |
47-
| classNames | { mask?: string; wrapper?: string; } | - | pass className to target area |
48-
| styles | { mask?: CSSProperties; wrapper?: CSSProperties; } | - | pass style to target area |
47+
| classNames | { mask?: string; content?: string; wrapper?: string; } | - | pass className to target area |
48+
| styles | { mask?: CSSProperties; content?: CSSProperties; wrapper?: CSSProperties; } | - | pass style to target area |
4949
| prefixCls | string | 'drawer' | prefix class |
5050
| width | string \| number | null | drawer content wrapper width, drawer level transition width |
5151
| height | string \| number | null | drawer content wrapper height, drawer level transition height |
@@ -63,7 +63,6 @@ ReactDom.render(
6363
| afterVisibleChange | func | null | transition end callback(open) |
6464
| onClose | func | null | close click function |
6565
| keyboard | boolean | true | Whether support press esc to close |
66-
| contentWrapperStyle | CSSProperties | null | content wrapper style |
6766
| autoFocus | boolean | true | Whether focusing on the drawer after it opened |
6867
| onMouseEnter | React.MouseEventHandler\<HTMLDivElement\> | - | Trigger when mouse enter drawer panel |
6968
| onMouseOver | React.MouseEventHandler\<HTMLDivElement\> | - | Trigger when mouse over drawer panel |

src/DrawerPopup.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export interface DrawerPopupProps extends DrawerPanelEvents {
4747
children?: React.ReactNode;
4848
width?: number | string;
4949
height?: number | string;
50-
contentWrapperStyle?: React.CSSProperties;
5150

5251
// Mask
5352
mask?: boolean;
@@ -98,7 +97,6 @@ function DrawerPopup(props: DrawerPopupProps, ref: React.Ref<HTMLDivElement>) {
9897
width,
9998
height,
10099
children,
101-
contentWrapperStyle,
102100

103101
// Mask
104102
mask,
@@ -304,7 +302,6 @@ function DrawerPopup(props: DrawerPopupProps, ref: React.Ref<HTMLDivElement>) {
304302
style={{
305303
...wrapperStyle,
306304
...motionStyle,
307-
...contentWrapperStyle,
308305
...styles?.wrapper,
309306
}}
310307
{...pickAttrs(props, { data: true })}

tests/index.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ describe('rc-drawer-menu', () => {
243243
});
244244
});
245245

246-
it('contentWrapperStyle', () => {
247-
render(<Drawer contentWrapperStyle={{ background: '#f00' }} open />);
246+
it('styles.wrapper', () => {
247+
render(<Drawer styles={{ wrapper: { background: '#f00' } }} open />);
248248

249249
expect(document.querySelector('.rc-drawer-content-wrapper')).toHaveStyle({
250250
background: '#f00',

tests/motion.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ describe('motion', () => {
1717
jest.useRealTimers();
1818
});
1919

20-
// zombieJ: Do not modify patch dom since user use `contentWrapperStyle` for override style
20+
// zombieJ: Do not modify patch dom since user use `styles.wrapper` for override style
2121
it('motion patch on the correct element', () => {
2222
const { container } = render(
2323
<Drawer
2424
width="93%"
2525
open
2626
getContainer={false}
2727
motion={{ motionName: 'bamboo', motionAppear: true }}
28-
contentWrapperStyle={{ background: 'red' }}
28+
styles={{ wrapper: { background: 'red' } }}
2929
/>,
3030
);
3131

0 commit comments

Comments
 (0)