mirror of
https://github.com/kevinsqi/react-circular-progressbar.git
synced 2026-01-18 15:55:06 +00:00
commit
380baebf08
@ -74,20 +74,20 @@ class CircularProgressbar extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { percentage, textForPercentage, className, strokeWidth } = this.props;
|
||||
const { percentage, textForPercentage, className, classes, strokeWidth } = this.props;
|
||||
const classForPercentage = this.props.classForPercentage ? this.props.classForPercentage(percentage) : '';
|
||||
const pathDescription = this.getPathDescription();
|
||||
const text = textForPercentage ? textForPercentage(percentage) : null;
|
||||
|
||||
return (
|
||||
<svg
|
||||
className={`CircularProgressbar ${className} ${classForPercentage}`}
|
||||
className={`${classes.root} ${className} ${classForPercentage}`}
|
||||
viewBox="0 0 100 100"
|
||||
>
|
||||
{
|
||||
this.props.background ? (
|
||||
<circle
|
||||
className="CircularProgressbar-background"
|
||||
className={classes.background}
|
||||
cx={50}
|
||||
cy={50}
|
||||
r={50}
|
||||
@ -96,14 +96,14 @@ class CircularProgressbar extends React.Component {
|
||||
}
|
||||
|
||||
<path
|
||||
className="CircularProgressbar-trail"
|
||||
className={classes.trail}
|
||||
d={pathDescription}
|
||||
strokeWidth={strokeWidth}
|
||||
fillOpacity={0}
|
||||
/>
|
||||
|
||||
<path
|
||||
className="CircularProgressbar-path"
|
||||
className={classes.path}
|
||||
d={pathDescription}
|
||||
strokeWidth={strokeWidth}
|
||||
fillOpacity={0}
|
||||
@ -113,7 +113,7 @@ class CircularProgressbar extends React.Component {
|
||||
{
|
||||
text ? (
|
||||
<text
|
||||
className="CircularProgressbar-text"
|
||||
className={classes.text}
|
||||
x={50}
|
||||
y={50}
|
||||
>
|
||||
@ -129,6 +129,7 @@ class CircularProgressbar extends React.Component {
|
||||
CircularProgressbar.propTypes = {
|
||||
percentage: PropTypes.number.isRequired,
|
||||
className: PropTypes.string,
|
||||
classes: PropTypes.objectOf(PropTypes.string),
|
||||
strokeWidth: PropTypes.number,
|
||||
background: PropTypes.bool,
|
||||
backgroundPadding: PropTypes.number,
|
||||
@ -140,6 +141,13 @@ CircularProgressbar.propTypes = {
|
||||
CircularProgressbar.defaultProps = {
|
||||
strokeWidth: 8,
|
||||
className: '',
|
||||
classes: {
|
||||
root: 'CircularProgressbar',
|
||||
trail: 'CircularProgressbar-trail',
|
||||
path: 'CircularProgressbar-path',
|
||||
text: 'CircularProgressbar-text',
|
||||
background: 'CircularProgressbar-background',
|
||||
},
|
||||
background: false,
|
||||
backgroundPadding: null,
|
||||
initialAnimation: false,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user