Skip to content

Commit 6ddace0

Browse files
authored
fix(Dialog): could custom margin-bottom when no footer fix alibaba-fusion#3799 (alibaba-fusion#3809)
1 parent efbdd15 commit 6ddace0

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

docs/dialog/theme/index.jsx

+15
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ class FunctionDemo extends Component {
5454
value: 'false'
5555
}]
5656
},
57+
footer: {
58+
label: '按钮',
59+
value: 'true',
60+
enum: [{
61+
label: '显示',
62+
value: 'true'
63+
}, {
64+
label: '隐藏',
65+
value: 'false'
66+
}]
67+
},
5768
footerAlign: {
5869
label: '按钮对齐方式',
5970
value: 'right',
@@ -102,6 +113,7 @@ class FunctionDemo extends Component {
102113
const locale = (lang === 'en-us' ? enUS : zhCN).Dialog;
103114
const hasTitle = this.state.demoFunction.hasTitle.value === 'true';
104115
const hasMask = this.state.demoFunction.hasMask.value === 'true';
116+
const footer = this.state.demoFunction.footer.value === 'true';
105117
const footerAlign = this.state.demoFunction.footerAlign.value;
106118
const okIsLeft = this.state.demoFunction.okPosition.value === 'left';
107119
const style = hasMask ?
@@ -111,6 +123,7 @@ class FunctionDemo extends Component {
111123
<Dialog.Inner
112124
style={style}
113125
title={hasTitle ? i18n.title : null}
126+
footer={footer}
114127
footerAlign={footerAlign}
115128
footerActions={okIsLeft ? ['ok', 'cancel'] : ['cancel', 'ok']}
116129
locale={locale}>
@@ -122,6 +135,7 @@ class FunctionDemo extends Component {
122135
<Dialog.Inner
123136
className="next-dialog-quick"
124137
style={style}
138+
footer={footer}
125139
footerAlign={footerAlign}
126140
footerActions={okIsLeft ? ['ok', 'cancel'] : ['cancel', 'ok']}
127141
locale={locale}>
@@ -137,6 +151,7 @@ class FunctionDemo extends Component {
137151
<Dialog.Inner
138152
className="next-dialog-quick"
139153
style={style}
154+
footer={footer}
140155
footerAlign={footerAlign}
141156
footerActions={okIsLeft ? ['ok', 'cancel'] : ['cancel', 'ok']}
142157
locale={locale}>

src/dialog/inner.jsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,15 @@ export default class Inner extends Component {
109109
}
110110

111111
renderBody() {
112-
const { prefix, children } = this.props;
112+
const { prefix, children, footer } = this.props;
113113
if (children) {
114114
return (
115-
<div className={`${prefix}dialog-body`} ref={this.getNode.bind(this, 'bodyNode')}>
115+
<div
116+
className={cx(`${prefix}dialog-body`, {
117+
[`${prefix}dialog-body-no-footer`]: footer === false
118+
})}
119+
ref={this.getNode.bind(this, 'bodyNode')}
120+
>
116121
{children}
117122
</div>
118123
);

src/dialog/main.scss

+7
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
color: $dialog-content-color;
3131
}
3232

33+
&-body-no-footer {
34+
margin-bottom: $dialog-content-margin-bottom-no-footer;
35+
}
36+
3337
/* 让用户自己设置 */
3438
/* &.#{$css-prefix}closeable &-header, */
3539
/* &.#{$css-prefix}closeable &-body, { */
@@ -164,6 +168,9 @@
164168
#{$dialog-prefix}-header + #{$dialog-prefix}-body {
165169
padding: $dialog-content-padding-top $dialog-content-padding-left-right $dialog-content-padding-bottom $dialog-content-padding-left-right;
166170
}
171+
#{$dialog-prefix}-header + #{$dialog-prefix}-body-no-footer {
172+
margin-bottom: $dialog-content-margin-bottom-no-footer;
173+
}
167174
}
168175

169176
&#{$dialog-prefix}-v2 {

src/dialog/scss/variable.scss

+3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ $dialog-content-padding-bottom: $s-5 !default;
6060
/// padding (l, r)
6161
/// @namespace size/content
6262
$dialog-content-padding-left-right: $s-5 !default;
63+
/// margin (b) no footer
64+
/// @namespace size/content
65+
$dialog-content-margin-bottom-no-footer: $s-0 !default;
6366
/// divider
6467
/// @namespace size/footer
6568
$dialog-footer-border-width: $line-zero !default;

0 commit comments

Comments
 (0)