mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-25 02:36:20 +01:00
Updated metrics logic.
This commit is contained in:
parent
c3426a67ee
commit
fd83b63a30
@ -1,3 +1,4 @@
|
|||||||
|
import classNames from 'classnames';
|
||||||
import { useSpring, animated } from 'react-spring';
|
import { useSpring, animated } from 'react-spring';
|
||||||
import { formatNumber } from 'lib/format';
|
import { formatNumber } from 'lib/format';
|
||||||
import styles from './MetricCard.module.css';
|
import styles from './MetricCard.module.css';
|
||||||
@ -20,15 +21,11 @@ const MetricCard = ({
|
|||||||
{label}
|
{label}
|
||||||
{~~change !== 0 && !hideComparison && (
|
{~~change !== 0 && !hideComparison && (
|
||||||
<animated.span
|
<animated.span
|
||||||
className={`${styles.change} ${
|
className={classNames(styles.change, {
|
||||||
change >= 0
|
[styles.positive]: change * (reverseColors ? -1 : 1) >= 0,
|
||||||
? !reverseColors
|
[styles.negative]: change * (reverseColors ? -1 : 1) < 0,
|
||||||
? styles.positive
|
[styles.plusSign]: change > 0,
|
||||||
: styles.negative
|
})}
|
||||||
: !reverseColors
|
|
||||||
? styles.negative
|
|
||||||
: styles.positive
|
|
||||||
} ${change >= 0 ? styles.plusSign : ''}`}
|
|
||||||
>
|
>
|
||||||
{changeProps.x.to(x => format(x))}
|
{changeProps.x.to(x => format(x))}
|
||||||
</animated.span>
|
</animated.span>
|
||||||
|
Loading…
Reference in New Issue
Block a user