Skip to content

Commit cefeaa7

Browse files
committed
refactor: section to container
1 parent 302f4f4 commit cefeaa7

File tree

8 files changed

+25
-25
lines changed

8 files changed

+25
-25
lines changed

assets/bootstrap/Dialog.less

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434
margin: 10px;
3535

3636
// Actual rc-dialog
37-
&-section {
37+
&-container {
3838
position: relative;
39-
background-color: @modal-section-bg;
40-
border: 1px solid @modal-section-fallback-border-color; //old browsers fallback (ie8 etc)
41-
border: 1px solid @modal-section-border-color;
39+
background-color: @modal-container-bg;
40+
border: 1px solid @modal-container-fallback-border-color; //old browsers fallback (ie8 etc)
41+
border: 1px solid @modal-container-border-color;
4242
border-radius: @border-radius-large;
4343
box-shadow: 0 3px 9px rgba(0, 0, 0, .5);
4444
background-clip: padding-box;
@@ -47,7 +47,7 @@
4747
}
4848

4949
// Modal header
50-
// Top section of the rc-dialog w/ title and dismiss
50+
// Top container of the rc-dialog w/ title and dismiss
5151
&-header {
5252
padding: @modal-title-padding;
5353
border-bottom: 1px solid @modal-header-border-color;
@@ -124,7 +124,7 @@
124124
width: @modal-md;
125125
margin: 30px auto;
126126

127-
&-section {
127+
&-container {
128128
box-shadow: 0 5px 15px rgba(0, 0, 0, .5);
129129
}
130130
}

assets/bootstrap/variables.less

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,11 +596,11 @@
596596
@modal-title-line-height: @line-height-base;
597597

598598
//** Background color of modal content area
599-
@modal-section-bg: #fff;
599+
@modal-container-bg: #fff;
600600
//** Modal content border color
601-
@modal-section-border-color: rgba(0,0,0,.2);
601+
@modal-container-border-color: rgba(0,0,0,.2);
602602
//** Modal content border color **for IE8**
603-
@modal-section-fallback-border-color: #999;
603+
@modal-container-fallback-border-color: #999;
604604

605605
//** Modal backdrop background color
606606
@modal-backdrop-bg: #000;

assets/index/Dialog.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
font-weight: bold;
2323
}
2424

25-
&-section {
25+
&-container {
2626
position: relative;
2727
background-color: #ffffff;
2828
border: none;

src/Dialog/Content/Panel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ const Panel = React.forwardRef<PanelRef, PanelProps>((props, ref) => {
140140

141141
const content = (
142142
<div
143-
className={classNames(`${prefixCls}-section`, modalClassNames?.section)}
144-
style={modalStyles?.section}
143+
className={classNames(`${prefixCls}-container`, modalClassNames?.container)}
144+
style={modalStyles?.container}
145145
>
146146
{closerNode}
147147
{headerNode}

src/IDialogPropTypes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { GetContainer } from '@rc-component/util/lib/PortalWrapper';
22
import type { CSSProperties, ReactNode, SyntheticEvent } from 'react';
33

4-
export type SemanticName = 'header' | 'body' | 'footer' | 'section' | 'title' | 'wrapper' | 'mask';
4+
export type SemanticName = 'header' | 'body' | 'footer' | 'container' | 'title' | 'wrapper' | 'mask';
55

66
export type ModalClassNames = Partial<Record<SemanticName, string>>;
77

tests/__snapshots__/index.spec.tsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ exports[`dialog add rootClassName and rootStyle should render correct 1`] = `
2424
tabindex="0"
2525
>
2626
<div
27-
class="rc-dialog-section"
27+
class="rc-dialog-container"
2828
>
2929
<button
3030
aria-label="Close"
@@ -71,7 +71,7 @@ exports[`dialog should render correct 1`] = `
7171
tabindex="0"
7272
>
7373
<div
74-
class="rc-dialog-section"
74+
class="rc-dialog-container"
7575
>
7676
<button
7777
aria-label="Close"
@@ -129,7 +129,7 @@ exports[`dialog should support classNames 1`] = `
129129
tabindex="0"
130130
>
131131
<div
132-
class="rc-dialog-section custom-section"
132+
class="rc-dialog-container custom-container"
133133
>
134134
<button
135135
aria-label="Close"
@@ -194,7 +194,7 @@ exports[`dialog should support styles 1`] = `
194194
tabindex="0"
195195
>
196196
<div
197-
class="rc-dialog-section"
197+
class="rc-dialog-container"
198198
style="background: orange;"
199199
>
200200
<button

tests/index.spec.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ describe('dialog', () => {
389389
}
390390
/>,
391391
);
392-
expect(document.querySelector('.rc-dialog-section')).toHaveStyle('background: #1890ff');
392+
expect(document.querySelector('.rc-dialog-container')).toHaveStyle('background: #1890ff');
393393
});
394394

395395
describe('focusTriggerAfterClose', () => {
@@ -597,7 +597,7 @@ describe('dialog', () => {
597597
footer: 'custom-footer',
598598
mask: 'custom-mask',
599599
wrapper: 'custom-wrapper',
600-
section: 'custom-section',
600+
container: 'custom-container',
601601
}}
602602
style={{ width: 600 }}
603603
height={903}
@@ -611,7 +611,7 @@ describe('dialog', () => {
611611
expect(document.querySelector('.rc-dialog-header').className).toContain('custom-header');
612612
expect(document.querySelector('.rc-dialog-footer').className).toContain('custom-footer');
613613
expect(document.querySelector('.rc-dialog-mask').className).toContain('custom-mask');
614-
expect(document.querySelector('.rc-dialog-section').className).toContain('custom-section');
614+
expect(document.querySelector('.rc-dialog-container').className).toContain('custom-container');
615615
});
616616

617617
it('should support styles', () => {
@@ -626,7 +626,7 @@ describe('dialog', () => {
626626
footer: { background: 'blue' },
627627
mask: { background: 'yellow' },
628628
wrapper: { background: 'pink' },
629-
section: { background: 'orange' },
629+
container: { background: 'orange' },
630630
title: { background: 'orange' },
631631
}}
632632
style={{ width: 600 }}
@@ -641,7 +641,7 @@ describe('dialog', () => {
641641
expect(document.querySelector('.rc-dialog-header')).toHaveStyle('background: red');
642642
expect(document.querySelector('.rc-dialog-footer')).toHaveStyle('background: blue');
643643
expect(document.querySelector('.rc-dialog-mask')).toHaveStyle('background: yellow');
644-
expect(document.querySelector('.rc-dialog-section')).toHaveStyle('background: orange');
644+
expect(document.querySelector('.rc-dialog-container')).toHaveStyle('background: orange');
645645
expect(document.querySelector('.rc-dialog-title')).toHaveStyle('background: orange');
646646
});
647647

tests/portal.spec.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ describe('Dialog.Portal', () => {
3030

3131
jest.runAllTimers();
3232

33-
fireEvent.mouseDown(document.querySelector('.rc-dialog-section'));
33+
fireEvent.mouseDown(document.querySelector('.rc-dialog-container'));
3434
fireEvent.click(document.querySelector('.rc-select-item-option-content'));
35-
fireEvent.mouseUp(document.querySelector('.rc-dialog-section'));
35+
fireEvent.mouseUp(document.querySelector('.rc-dialog-container'));
3636
expect(onClose).not.toHaveBeenCalled();
3737
});
3838

@@ -47,7 +47,7 @@ describe('Dialog.Portal', () => {
4747

4848
jest.runAllTimers();
4949

50-
fireEvent.mouseDown(document.querySelector('.rc-dialog-section'));
50+
fireEvent.mouseDown(document.querySelector('.rc-dialog-container'));
5151
fireEvent.mouseUp(document.querySelector('.rc-dialog-wrap'));
5252
expect(onClose).not.toHaveBeenCalled();
5353
});

0 commit comments

Comments
 (0)