You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

52 lines
1.3 KiB

import React from 'react';
import classNames from 'classnames';
export interface TimeLineItemProps {
prefixCls?: string;
className?: string;
color?: string;
dot?: React.ReactNode;
pending?: boolean;
last?: boolean;
style?: React.CSSProperties;
}
export default class TimelineItem extends React.Component<TimeLineItemProps, any> {
static defaultProps = {
prefixCls: 'ant-timeline',
color: 'blue',
last: false,
pending: false,
};
render() {
const { prefixCls, className, color = '', last, children, pending, dot, ...restProps } = this.props;
const itemClassName = classNames({
[`${prefixCls}-item`]: true,
[`${prefixCls}-item-last`]: last,
[`${prefixCls}-item-pending`]: pending,
}, className);
const dotClassName = classNames({
[`${prefixCls}-item-head`]: true,
[`${prefixCls}-item-head-custom`]: dot,
[`${prefixCls}-item-head-${color}`]: true,
});
return (
<li {...restProps} className={itemClassName}>
<div className={`${prefixCls}-item-tail`} />
<div
className={dotClassName}
style={{ borderColor: /blue|red|green/.test(color) ? null : color }}
>
{dot}
</div>
<div className={`${prefixCls}-item-content`}>
{children}
</div>
</li>
);
}
}