clean up code

This commit is contained in:
afc163 2019-03-06 15:23:51 +08:00
parent 0fe82ed936
commit 575796cb92
No known key found for this signature in database
GPG Key ID: 738F973FCE5C6B48

View File

@ -81,8 +81,6 @@ export default class Item extends React.Component<ListItemProps, any> {
...others
} = this.props;
const prefixCls = getPrefixCls('list', customizePrefixCls);
const classString = classNames(`${prefixCls}-item`, className);
const actionsContent = actions && actions.length > 0 && (
<ul className={`${prefixCls}-item-action`}>
{actions.map((action: React.ReactNode, i: number) => (
@ -93,8 +91,9 @@ export default class Item extends React.Component<ListItemProps, any> {
))}
</ul>
);
const extraContent = (
const itemChildren = (
<div {...others} className={classNames(`${prefixCls}-item`, className)}>
{extra ? (
<div className={`${prefixCls}-item-extra-wrap`}>
<div className={`${prefixCls}-item-main`}>
{children}
@ -102,15 +101,13 @@ export default class Item extends React.Component<ListItemProps, any> {
</div>
<div className={`${prefixCls}-item-extra`}>{extra}</div>
</div>
);
const itemChildren = (
<div {...others} className={classString}>
{extra ? extraContent : [children, actionsContent]}
) : (
[children, actionsContent]
)}
</div>
);
const mainContent = grid ? (
return grid ? (
<Col
span={getGrid(grid, 'column')}
xs={getGrid(grid, 'xs')}
@ -125,8 +122,6 @@ export default class Item extends React.Component<ListItemProps, any> {
) : (
itemChildren
);
return mainContent;
};
render() {