-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(FormattedBytes): show 1_000 with another unit #1901
Conversation
@@ -11,5 +11,5 @@ export const toFormattedSize = ( | |||
return null; | |||
} | |||
|
|||
return <FormattedBytes value={value} significantDigits={2} {...params} />; | |||
return <FormattedBytes value={value} {...params} />; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we don't use significantDigits
param any more. What do you think about remove it completely? It seems it will simplify logic for formatting values a lot.
c3a264d
to
f37941a
Compare
const result1 = formatNumericValues(10, 20); | ||
expect(result1).toEqual(['10', `20`]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before in such case formatNumericValues
returned ['0', '0']
let size: Digits = 'thousand'; | ||
|
||
if (value > thousandLevel) { | ||
export const getNumberSizeUnit = (value: number) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May we use http://numeraljs.com/ instead of custom unit getter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use custom getter, because together with auto formatting we can pass specific unit - it's helpful for data inside tables (data on every row should be with the same unit). AFAIK numeral
cannot do formatting to specific units. While formatNumber
is not widely used, formatBytes
with the same approach is used in most of the tables
Closes #1455
Before:
![Screenshot 2025-02-03 at 14 18 13](https://private-user-images.githubusercontent.com/67755036/409083689-f254f688-72d2-4c4b-bb61-731e9796f426.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MjUwNjMsIm5iZiI6MTczOTQyNDc2MywicGF0aCI6Ii82Nzc1NTAzNi80MDkwODM2ODktZjI1NGY2ODgtNzJkMi00YzRiLWJiNjEtNzMxZTk3OTZmNDI2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDA1MzI0M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQzYjhiNjVkZWJmYmFmNmVkMmVmY2RhYTEwMDc3YmMyY2E0MDc3NGI3MmZmN2U3ZDhlNjQ5NjIzMTZjODgyODcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.fBxDCo15kW6Th6-tgV2Qf-q2URLF1k2ynLp1GqA5Hsk)
After:
![Screenshot 2025-02-03 at 14 18 32](https://private-user-images.githubusercontent.com/67755036/409083672-a7700d89-e99b-4d68-8b34-2b61cc86d497.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MjUwNjMsIm5iZiI6MTczOTQyNDc2MywicGF0aCI6Ii82Nzc1NTAzNi80MDkwODM2NzItYTc3MDBkODktZTk5Yi00ZDY4LThiMzQtMmI2MWNjODZkNDk3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDA1MzI0M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTZjYjE2NjUzZGQ0NTFhYWYwYWJhNGVlMjFmNWU1YTkyZGZkMzNiOTYxMzU0YmNiZTBkZGI3YzVhYmRiZTVjODImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.a-5m7YD6JFhBmfrY-O7z2V4RGruMZhEtcmDHtIe9cmI)
CI Results
Test Status: β PASSED
π Full Report
π No changes in tests. π
Bundle Size: β
Current: 80.19 MB | Main: 80.20 MB
Diff: 2.37 KB (-0.00%)
β Bundle size unchanged.
βΉοΈ CI Information