'use strict'; var Progressline = require('rc-progress').Line; var Progresscircle = require('rc-progress').Circle; var React = require('react'); var Line = React.createClass({ getDefaultProps: function () { return { percent: 0, strokeWidth: 2, status: "normal" // exception } }, render() { var statusColorMap = { "normal": "#3FC7FA", "exception": "#FE8C6A", "success": "#85D262" }; if (parseInt(this.props.percent) === 100) { this.props.status = 'success' } var style = { "width": this.props.width } var wrapStyle = { "font-size": this.props.width / 100 * this.props.strokeWidth } var textStyle = { "color": statusColorMap[this.props.status] } var progressInfo if (this.props.status === 'exception') { progressInfo = ( ) } else if(this.props.status === 'success'){ progressInfo = ( ) }else { progressInfo = ( {this.props.percent}% ) } return (
{progressInfo}
); } }); var Circle = React.createClass({ getDefaultProps: function () { return { percent: 0, strokeWidth: 2, status: "normal" // exception } }, render() { var statusColorMap = { "normal": "#3FC7FA", "exception": "#FE8C6A", "success": "#85D262" }; if (parseInt(this.props.percent) === 100) { this.props.status = 'success' } var style = { "width": this.props.width, "height": this.props.width } var wrapStyle = { "font-size": this.props.width * 0.3 } var textStyle = { "color": statusColorMap[this.props.status] } var progressInfo if (this.props.status === 'exception') { progressInfo = ( ) }else { progressInfo = ( {this.props.percent}% ) } return (
{progressInfo}
); } }); module.exports = { Line: Line, Circle: Circle };