Skip to content

Commit 17f8f96

Browse files
authored
refactor: update content to section (#478)
1 parent c3471c8 commit 17f8f96

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

src/DrawerPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const DrawerPanel = (props: DrawerPanelProps) => {
4343

4444
return (
4545
<div
46-
className={classNames(`${prefixCls}-content`, className)}
46+
className={classNames(`${prefixCls}-section`, className)}
4747
role="dialog"
4848
ref={mergedRef}
4949
{...pickAttrs(props, { aria: true })}

src/DrawerPopup.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,10 @@ function DrawerPopup(props: DrawerPopupProps, ref: React.Ref<HTMLDivElement>) {
298298
id={id}
299299
containerRef={motionRef}
300300
prefixCls={prefixCls}
301-
className={classNames(className, drawerClassNames?.content)}
301+
className={classNames(className, drawerClassNames?.section)}
302302
style={{
303303
...style,
304-
...styles?.content,
304+
...styles?.section,
305305
}}
306306
{...pickAttrs(props, { aria: true })}
307307
{...eventHandlers}

src/inter.ts

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

77
export interface DrawerStyles {
88
mask?: React.CSSProperties;
99
wrapper?: React.CSSProperties;
10-
content?: React.CSSProperties;
10+
section?: React.CSSProperties;
1111
}

tests/index.spec.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ describe('rc-drawer-menu', () => {
301301
const { container } = render(
302302
<Drawer open getContainer={false} onClose={onClose} />,
303303
);
304-
fireEvent.keyDown(container.querySelector('.rc-drawer-content'), {
304+
fireEvent.keyDown(container.querySelector('.rc-drawer-section'), {
305305
keyCode: KeyCode.ESC,
306306
});
307307
expect(onClose).toHaveBeenCalled();
@@ -312,7 +312,7 @@ describe('rc-drawer-menu', () => {
312312
const { container } = render(
313313
<Drawer open getContainer={false} onClose={onClose} keyboard={false} />,
314314
);
315-
fireEvent.keyDown(container.querySelector('.rc-drawer-content'), {
315+
fireEvent.keyDown(container.querySelector('.rc-drawer-section'), {
316316
keyCode: KeyCode.ESC,
317317
});
318318
expect(onClose).not.toHaveBeenCalled();
@@ -376,20 +376,20 @@ describe('rc-drawer-menu', () => {
376376
const { baseElement } = render(
377377
<Drawer width="93" open onMouseEnter={enter} onMouseLeave={leave} />,
378378
);
379-
fireEvent.mouseOver(baseElement.querySelector('.rc-drawer-content'));
379+
fireEvent.mouseOver(baseElement.querySelector('.rc-drawer-section'));
380380
expect(enter).toHaveBeenCalled();
381-
fireEvent.mouseLeave(baseElement.querySelector('.rc-drawer-content'));
381+
fireEvent.mouseLeave(baseElement.querySelector('.rc-drawer-section'));
382382
expect(leave).toHaveBeenCalled();
383383
});
384384

385385
it('pass id & className props to Panel', () => {
386386
const { unmount } = render(
387387
<Drawer className="customer-className" id="customer-id" open />,
388388
);
389-
expect(document.querySelector('.rc-drawer-content')).toHaveClass(
389+
expect(document.querySelector('.rc-drawer-section')).toHaveClass(
390390
'customer-className',
391391
);
392-
expect(document.querySelector('.rc-drawer-content')).toHaveAttribute(
392+
expect(document.querySelector('.rc-drawer-section')).toHaveAttribute(
393393
'id',
394394
'customer-id',
395395
);
@@ -430,7 +430,7 @@ describe('rc-drawer-menu', () => {
430430
classNames={{
431431
wrapper: 'customer-wrapper',
432432
mask: 'customer-mask',
433-
content: 'customer-content',
433+
section: 'customer-section',
434434
}}
435435
open
436436
/>,
@@ -441,8 +441,8 @@ describe('rc-drawer-menu', () => {
441441
expect(document.querySelector('.rc-drawer-mask')).toHaveClass(
442442
'customer-mask',
443443
);
444-
expect(document.querySelector('.rc-drawer-content')).toHaveClass(
445-
'customer-content',
444+
expect(document.querySelector('.rc-drawer-section')).toHaveClass(
445+
'customer-section',
446446
);
447447
unmount();
448448
});
@@ -452,7 +452,7 @@ describe('rc-drawer-menu', () => {
452452
styles={{
453453
wrapper: { background: 'red' },
454454
mask: { background: 'blue' },
455-
content: { background: 'green' },
455+
section: { background: 'green' },
456456
}}
457457
open
458458
/>,
@@ -463,7 +463,7 @@ describe('rc-drawer-menu', () => {
463463
expect(document.querySelector('.rc-drawer-mask')).toHaveStyle(
464464
'background: blue',
465465
);
466-
expect(document.querySelector('.rc-drawer-content')).toHaveStyle(
466+
expect(document.querySelector('.rc-drawer-section')).toHaveStyle(
467467
'background: green',
468468
);
469469
unmount();

tests/ref.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ describe('Drawer.ref', () => {
2020
jest.runAllTimers();
2121
});
2222

23-
expect(panelRef.current).toHaveClass('rc-drawer-content');
23+
expect(panelRef.current).toHaveClass('rc-drawer-section');
2424
});
2525
});

0 commit comments

Comments
 (0)