Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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}
Expand All @@ -113,7 +113,7 @@ class CircularProgressbar extends React.Component {
{
text ? (
<text
className="CircularProgressbar-text"
className={classes.text}
x={50}
y={50}
>
Expand All @@ -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,
Expand All @@ -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,
Expand Down