mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-23 22:48:07 +01:00
[Glitch] Fix shortNumberFormat to within 3 chars without units
Port 0e8c0287d0
to glitch-soc
Signed-off-by: Thibaut Girka <thib@sitedethib.com>
This commit is contained in:
parent
01eaeab56d
commit
83359fef2b
2 changed files with 8 additions and 4 deletions
|
@ -681,13 +681,13 @@
|
|||
&__links {
|
||||
font-size: 14px;
|
||||
color: $darker-text-color;
|
||||
padding: 10px 0;
|
||||
|
||||
a {
|
||||
display: inline-block;
|
||||
color: $darker-text-color;
|
||||
text-decoration: none;
|
||||
padding: 10px;
|
||||
padding-top: 20px;
|
||||
padding: 5px 10px;
|
||||
font-weight: 500;
|
||||
|
||||
strong {
|
||||
|
|
|
@ -4,9 +4,13 @@ import { FormattedNumber } from 'react-intl';
|
|||
export const shortNumberFormat = number => {
|
||||
if (number < 1000) {
|
||||
return <FormattedNumber value={number} />;
|
||||
} else if (number < 1000000) {
|
||||
} else if (number < 10000) {
|
||||
return <Fragment><FormattedNumber value={number / 1000} maximumFractionDigits={1} />K</Fragment>;
|
||||
} else {
|
||||
} else if (number < 1000000) {
|
||||
return <Fragment><FormattedNumber value={number / 1000} maximumFractionDigits={0} />K</Fragment>;
|
||||
} else if (number < 10000000) {
|
||||
return <Fragment><FormattedNumber value={number / 1000000} maximumFractionDigits={1} />M</Fragment>;
|
||||
} else {
|
||||
return <Fragment><FormattedNumber value={number / 1000000} maximumFractionDigits={0} />M</Fragment>;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue