Format long numbers. Updated README.

This commit is contained in:
Mike Cao 2020-08-19 14:35:38 -07:00
parent c6b9682296
commit b1493dfef8
10 changed files with 77 additions and 26 deletions

View file

@ -1,12 +1,9 @@
import React from 'react';
import { useSpring, animated } from 'react-spring';
import { formatNumber } from '../../lib/format';
import styles from './MetricCard.module.css';
function defaultFormat(n) {
return Number(n).toFixed(0);
}
const MetricCard = ({ value = 0, label, format = defaultFormat }) => {
const MetricCard = ({ value = 0, label, format = formatNumber }) => {
const props = useSpring({ x: value, from: { x: 0 } });
return (