Skip to content

Commit

Permalink
Fix fixed number in Range
Browse files Browse the repository at this point in the history
  • Loading branch information
Laica-Lunasys committed Mar 5, 2021
1 parent 87f73b1 commit 73408a0
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ class Range extends React.Component<Props, State> {
<H1>
<Span>
{this.props.title && this.props.title}
{this.state.value.toFixed(1)}
{this.state.value.toFixed((() => {
const e = String(this.props.step).split('.')
return e.length !== 1 ? e[e.length - 1].length : 0
})())}
{this.props.suffix && <span style={{ fontSize: "0.5em", fontWeight: 400 }}>{this.props.suffix}</span>}
</Span>
</H1>
Expand Down

0 comments on commit 73408a0

Please sign in to comment.