From 1d7d84cc7b8daab41cb0c5fb78fa779295ca982e Mon Sep 17 00:00:00 2001 From: Andy Edwards Date: Mon, 18 Sep 2017 17:59:26 -0500 Subject: [PATCH] don't render if textForPercentage is falsy or returns falsy fix #24 --- src/index.jsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/index.jsx b/src/index.jsx index ed9b622..f5fc6bd 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -74,12 +74,15 @@ class CircularProgressbar extends React.Component { } render() { - const classForPercentage = this.props.classForPercentage ? this.props.classForPercentage(this.props.percentage) : ''; + const {percentage, classForPercentage, textForPercentage, className, strokeWidth} = this.props + const classForPercentage = classForPercentage ? classForPercentage(percentage) : ''; const pathDescription = this.getPathDescription(); + + const text = textForPercentage ? textForPercentage(percentage) : null return ( { @@ -96,25 +99,25 @@ class CircularProgressbar extends React.Component { - - {this.props.textForPercentage(this.props.percentage)} - + {text} + : null} ); }