ant-design/components/timeline/TimelineItem.jsx

41 lines
1.1 KiB
React
Raw Normal View History

2016-03-31 17:46:35 +08:00
import React from 'react';
import classNames from 'classnames';
export default class TimelineItem extends React.Component {
static defaultProps = {
prefixCls: 'ant-timeline',
color: 'blue',
last: false,
pending: false,
}
render() {
const { prefixCls, color, last, children, pending, className, dot, ...restProps } = this.props;
2016-03-31 17:46:35 +08:00
const itemClassName = classNames({
[`${prefixCls}-item`]: true,
[`${prefixCls}-item-last`]: last,
[`${prefixCls}-item-pending`]: pending,
2016-04-18 16:17:16 +08:00
[className]: className,
2016-03-31 17:46:35 +08:00
});
const dotClassName = classNames({
[`${prefixCls}-item-head`]: true,
[`${prefixCls}-item-head-custom`]: dot,
[`${prefixCls}-item-head-${color}`]: true,
});
2016-03-31 17:46:35 +08:00
return (
2016-04-18 16:17:16 +08:00
<li {...restProps} className={itemClassName}>
2016-03-31 17:46:35 +08:00
<div className={`${prefixCls}-item-tail`} />
<div className={dotClassName} style={{ color: /blue|red|green/.test(color) ? null : color }}>
{dot}
</div>
<div className={`${prefixCls}-item-content`}>
{children}
</div>
2016-03-31 17:46:35 +08:00
</li>
);
}
}