Skip to content

Commit

Permalink
Fix display of empty values in progress bar (#9581)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maciej Bulczak committed Sep 28, 2022
1 parent 1efcb81 commit 29c3849
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions examples/12.1.2/docs/react/demo/src/renderers/ProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ export class ProgressBarRenderer extends BaseEditorComponent {
}

getRangeValue(value: string): string {
if (parseInt(value) < 0) {
const numberValue = parseInt(value);
if (numberValue < 0 || !numberValue) {
return '0';
}
if (parseInt(value) > 100) {
if (numberValue > 100) {
return '100';
}
return value;
Expand All @@ -105,7 +106,7 @@ export class ProgressBarRenderer extends BaseEditorComponent {

return (
<div style={{marginTop: 6}}>
<div className="progressBar" style={{ width: `${this.props.value}px` }} />
<div className="progressBar" style={{ width: `${this.getRangeValue(this.props.value)}px` }} />
</div>
);
}
Expand Down

0 comments on commit 29c3849

Please sign in to comment.