mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-04 04:58:55 +08:00
⚡ clean up code
This commit is contained in:
parent
0fe82ed936
commit
575796cb92
@ -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,24 +91,23 @@ export default class Item extends React.Component<ListItemProps, any> {
|
||||
))}
|
||||
</ul>
|
||||
);
|
||||
|
||||
const extraContent = (
|
||||
<div className={`${prefixCls}-item-extra-wrap`}>
|
||||
<div className={`${prefixCls}-item-main`}>
|
||||
{children}
|
||||
{actionsContent}
|
||||
</div>
|
||||
<div className={`${prefixCls}-item-extra`}>{extra}</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
const itemChildren = (
|
||||
<div {...others} className={classString}>
|
||||
{extra ? extraContent : [children, actionsContent]}
|
||||
<div {...others} className={classNames(`${prefixCls}-item`, className)}>
|
||||
{extra ? (
|
||||
<div className={`${prefixCls}-item-extra-wrap`}>
|
||||
<div className={`${prefixCls}-item-main`}>
|
||||
{children}
|
||||
{actionsContent}
|
||||
</div>
|
||||
<div className={`${prefixCls}-item-extra`}>{extra}</div>
|
||||
</div>
|
||||
) : (
|
||||
[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() {
|
||||
|
Loading…
Reference in New Issue
Block a user