Skip to content

Commit

Permalink
don't use countup when animation not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
razvanMiu committed Sep 16, 2022
1 parent 0b89f22 commit 1dddc5e
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions src/StatisticBlock/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,19 @@ const View = ({ data, mode }) => {
: {})}
>
<Statistic.Value className={cx(valueVariation)}>
<CountUp
end={Number(item.value)}
duration={
animation.enabled
? animation.duration > 0
? animation.duration
: 2
: 0
}
decimals={animation.decimals > 0 ? animation.decimals : 0}
prefix={animation.prefix || ''}
suffix={animation.suffix || ''}
>
{(props) => <CountUpWrapper {...props} />}
</CountUp>
{animation.enabled ? (
<CountUp
end={Number(item.value)}
duration={animation.duration > 0 ? animation.duration : 2}
decimals={animation.decimals > 0 ? animation.decimals : 0}
prefix={animation.prefix || ''}
suffix={animation.suffix || ''}
>
{(props) => <CountUpWrapper {...props} />}
</CountUp>
) : (
item.value
)}
</Statistic.Value>
<Statistic.Label className={cx(labelVariation)}>
{item.label}
Expand Down

0 comments on commit 1dddc5e

Please sign in to comment.