import {Circle as Progresscircle} from 'rc-progress'; import React from 'react'; import assign from 'object-assign'; const prefixCls = 'ant-progress'; const statusColorMap = { 'normal': '#2db7f5', 'exception': '#ff6600', 'success': '#87d068' }; var Line = React.createClass({ propTypes: { status: React.PropTypes.oneOf(['normal', 'exception', 'active', 'success']), showInfo: React.PropTypes.bool, percent: React.PropTypes.number, strokeWidth: React.PropTypes.number }, getDefaultProps() { return { percent: 0, strokeWidth: 10, status: 'normal', // exception active showInfo: true }; }, render() { var props = assign({}, this.props); if (parseInt(props.percent) === 100) { props.status = 'success'; } var progressInfo, fullCls = ''; if(props.showInfo === true){ if (props.status === 'exception') { progressInfo = ( ); } else if (props.status === 'success') { progressInfo = ( ); } else { progressInfo = ( {props.percent}% ); } }else { fullCls = ' ' + prefixCls + '-line-wrap-full'; } var percentStyle = { width: props.percent + '%', height: props.strokeWidth }; return (
{progressInfo}
); } }); var Circle = React.createClass({ getDefaultProps: function () { return { width: 132, percent: 0, strokeWidth: 6, status: 'normal' // exception }; }, render() { var props = assign({}, this.props); if (parseInt(props.percent) === 100) { props.status = 'success'; } var style = { 'width': props.width, 'height': props.width, 'fontSize': props.width * 0.16 + 6 }; var progressInfo; if (props.status === 'exception') { progressInfo = ( ); } else if (props.status === 'success') { progressInfo = ( ); } else { progressInfo = ( {props.percent}% ); } return (
{progressInfo}
); } }); export default { Line: Line, Circle: Circle };