diff --git a/README.md b/README.md index 01c37b5..32786a0 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,12 @@ React.render(
#D9D9D9 Color for lighter trail stroke underneath the actual progress path. + + strokeLinecap + String + round + The shape to be used at the end of the progress bar, can be square or round. + diff --git a/examples/simple.js b/examples/simple.js index bfdf7f6..deedff1 100644 --- a/examples/simple.js +++ b/examples/simple.js @@ -30,17 +30,17 @@ const Example = React.createClass({

Line Progress {this.state.percent}%

- +

Circle Progress {this.state.percent}%

- +

- ); + ); }, }); diff --git a/src/Line.jsx b/src/Line.jsx index 6e70985..3588dc3 100644 --- a/src/Line.jsx +++ b/src/Line.jsx @@ -31,13 +31,15 @@ const Line = React.createClass({ const right = (100 - strokeWidth / 2); const pathString = `M ${center},${center} L ${right},${center}`; const viewBoxString = `0 0 100 ${strokeWidth}`; + const linecap = props.strokeLinecap || 'round'; + return ( - - ); diff --git a/src/Progress.js b/src/Progress.js index 2a4c4a6..01efc37 100644 --- a/src/Progress.js +++ b/src/Progress.js @@ -17,6 +17,8 @@ const Circle = React.createClass({ 'strokeDashoffset': `${((100 - props.percent) / 100 * len)}px`, 'transition': 'stroke-dashoffset 0.6s ease 0s, stroke 0.6s ease', }; + const linecap = props.strokeLinecap || 'round'; + ['strokeWidth', 'strokeColor', 'trailWidth', 'trailColor'].forEach((item) => { if (item === 'trailWidth' && !props.trailWidth && props.strokeWidth) { props.trailWidth = props.strokeWidth; @@ -32,7 +34,7 @@ const Circle = React.createClass({ - );