mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
💄 format getGutter code style
This commit is contained in:
parent
78a1427ec0
commit
0cadae921a
@ -64,23 +64,23 @@ export default class Row extends React.Component<RowProps, RowState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getGutter(): [number, number] {
|
getGutter(): [number, number] {
|
||||||
const gutter: [number, number] = [0, 0];
|
const results: [number, number] = [0, 0];
|
||||||
const { gutter: gutter_setting } = this.props;
|
const { gutter } = this.props;
|
||||||
|
const { screens } = this.state;
|
||||||
(Array.isArray(gutter_setting) ? gutter_setting : [gutter_setting, 0]).forEach((g, index) => {
|
const normalizedGutter = Array.isArray(gutter) ? gutter : [gutter, 0];
|
||||||
|
normalizedGutter.forEach((g, index) => {
|
||||||
if (typeof g === 'object') {
|
if (typeof g === 'object') {
|
||||||
for (let i = 0; i < responsiveArray.length; i++) {
|
for (let i = 0; i < responsiveArray.length; i++) {
|
||||||
const breakpoint: Breakpoint = responsiveArray[i];
|
const breakpoint: Breakpoint = responsiveArray[i];
|
||||||
if (this.state.screens[breakpoint] && g[breakpoint] !== undefined) {
|
if (screens[breakpoint] && g[breakpoint] !== undefined) {
|
||||||
gutter[index] = g[breakpoint] as number;
|
results[index] = g[breakpoint] as number;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gutter[index] = g as number;
|
results[index] = g || 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return results;
|
||||||
return gutter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
renderRow = ({ getPrefixCls }: ConfigConsumerProps) => {
|
renderRow = ({ getPrefixCls }: ConfigConsumerProps) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user