Skip to content

Commit 2ea8730

Browse files
authored
feat: classNames & styles support content (#428)
1 parent 0b0d4a0 commit 2ea8730

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/DrawerPopup.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,11 @@ function DrawerPopup(props: DrawerPopupProps, ref: React.Ref<HTMLDivElement>) {
313313
id={id}
314314
containerRef={motionRef}
315315
prefixCls={prefixCls}
316-
className={className}
317-
style={style}
316+
className={classNames(className, drawerClassNames?.content)}
317+
style={{
318+
...style,
319+
...styles?.content,
320+
}}
318321
{...eventHandlers}
319322
>
320323
{children}

src/inter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
export interface DrawerClassNames {
22
mask?: string;
33
wrapper?: string;
4+
content?: string;
45
}
56

67
export interface DrawerStyles {
78
mask?: React.CSSProperties;
89
wrapper?: React.CSSProperties;
10+
content?: React.CSSProperties;
911
}

tests/index.spec.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ describe('rc-drawer-menu', () => {
401401
<Drawer classNames={{
402402
wrapper: 'customer-wrapper',
403403
mask: 'customer-mask',
404+
content: 'customer-content',
404405
}} open />
405406
);
406407
expect(
@@ -409,13 +410,17 @@ describe('rc-drawer-menu', () => {
409410
expect(
410411
document.querySelector('.rc-drawer-mask')
411412
).toHaveClass('customer-mask');
413+
expect(
414+
document.querySelector('.rc-drawer-content')
415+
).toHaveClass('customer-content');
412416
unmount();
413417
});
414418
it('should support styles', () => {
415419
const { unmount } = render(
416420
<Drawer styles={{
417421
wrapper: { background: 'red' },
418422
mask: { background: 'blue' },
423+
content: { background: 'green' },
419424
}} open />
420425
);
421426
expect(
@@ -424,6 +429,9 @@ describe('rc-drawer-menu', () => {
424429
expect(
425430
document.querySelector('.rc-drawer-mask')
426431
).toHaveStyle('background: blue');
432+
expect(
433+
document.querySelector('.rc-drawer-content')
434+
).toHaveStyle('background: green');
427435
unmount();
428436
});
429437
});

0 commit comments

Comments
 (0)