Number display formatting (#1556)

* number display formatting

* - add tests
This commit is contained in:
brendanlaschke
2023-09-13 11:12:25 +03:00
committed by GitHub
parent 7e6c9141f4
commit 84b474c3cc
7 changed files with 47 additions and 9 deletions

View File

@ -1,6 +1,6 @@
import styled from '@emotion/styled';
import { formatNumber } from '~/utils/formatNumber';
import { formatNumber } from '~/utils/format/number';
const StyledTextInputDisplay = styled.div`
overflow: hidden;

View File

@ -0,0 +1,22 @@
import styled from '@emotion/styled';
import { formatNumber } from '~/utils/format/number';
const StyledNumberDisplay = styled.div`
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 100%;
`;
type OwnProps = {
value: string;
};
export function NumberDisplay({ value }: OwnProps) {
return (
<StyledNumberDisplay>
{value && formatNumber(Number(value))}
</StyledNumberDisplay>
);
}