ant-design/components/card/index.jsx
2016-02-22 16:28:00 +08:00

37 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from 'react';
import classNames from 'classnames';
export default props => {
let { prefixCls = 'ant-card', className, children, extra, bodyStyle, title, loading, ...other } = props;
const classString = classNames({
[prefixCls]: true,
[className]: !!className,
[`${prefixCls}-loading`]: loading,
});
if (loading) {
children = (
<div>
<p></p>
<p> </p>
<p> </p>
<p>  </p>
</div>
);
}
const head = title ? (
<div className={`${prefixCls}-head`}>
<h3 className={`${prefixCls}-head-title`}>{title}</h3>
</div>
) : null;
return (
<div {...other} className={classString}>
{head}
{extra ? <div className={`${prefixCls}-extra`}>{extra}</div> : null}
<div className={`${prefixCls}-body`} style={bodyStyle}>{children}</div>
</div>
);
};