diff --git a/components/progress/demo/circle.md b/components/progress/demo/circle.md new file mode 100644 index 0000000000..d01a209638 --- /dev/null +++ b/components/progress/demo/circle.md @@ -0,0 +1,19 @@ +# Circle 用法 + +- order: 0 + +Progress Circle用法 + +--- + +````jsx +var Circle = antd.Progress.Circle; + +React.render( +
+ + + +
+ , document.getElementById('components-progress-demo-circle')); +```` diff --git a/components/progress/index.jsx b/components/progress/index.jsx index 6774126088..a9724d1454 100644 --- a/components/progress/index.jsx +++ b/components/progress/index.jsx @@ -66,37 +66,52 @@ var Line = React.createClass({ var Circle = React.createClass({ getDefaultProps: function () { return { - width: "100%", percent: 0, - strokeWidth: 1, - status: "normal" + 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 + } + var textStyle = { + "color": statusColorMap[this.props.status] + } var progressInfo - if (this.props.status === 'normal') { + if (this.props.status === 'exception') { progressInfo = ( - + + + ) - } else { + }else { progressInfo = ( - {this.props.percent}% + {this.props.percent}% ) } - var statusColorMap = { - "normal": "#3FC7FA", - "exception": "#FE8C6A" - }; return ( -
- +
+ - {progressInfo} + {progressInfo} +
); } diff --git a/style/components/progress.less b/style/components/progress.less index 28071c181b..4cb89095cb 100644 --- a/style/components/progress.less +++ b/style/components/progress.less @@ -19,4 +19,20 @@ font-size: 1.5em; } } + + &-circle-inner { + position: relative; + } + &-circle-text { + display: block; + position: absolute; + width: 100%; + height: 100%; + font-size: 0.5em; + text-align: center; + + .anticon { + font-size: 0.5em; + } + } } \ No newline at end of file