Replace formatLongNumber with intl.formatNumber

This commit is contained in:
Minseo Lee 2024-08-30 09:59:43 +09:00
parent 5636bd9617
commit 16f86c7715
12 changed files with 44 additions and 48 deletions

View file

@ -1,7 +1,8 @@
import { ReactNode } from 'react';
import { Loading, cloneChildren } from 'react-basics';
import ErrorMessage from 'components/common/ErrorMessage';
import { formatLongNumber } from 'lib/format';
import { formatLongNumberOptions } from 'lib/format';
import { useIntl } from 'react-intl';
import styles from './MetricsBar.module.css';
export interface MetricsBarProps {
@ -12,7 +13,8 @@ export interface MetricsBarProps {
}
export function MetricsBar({ children, isLoading, isFetched, error }: MetricsBarProps) {
const formatFunc = n => (n >= 0 ? formatLongNumber(n) : `-${formatLongNumber(Math.abs(n))}`);
const intl = useIntl();
const formatFunc = (n: number) => intl.formatNumber(n, formatLongNumberOptions(n));
return (
<div className={styles.bar}>