Split shared UI knowledge into atomic topic directories
This commit is contained in:
1 parent
08ff987edb
commit
b0e6402d66
37 files changed
+600
-516
No files matched your search
@@ -0,0 +1,18 @@
|
||||
# Whole-unit amounts and missing values
|
||||
|
||||
This USD example follows the operator UI's display convention. Currency is a product choice, not a shared
|
||||
hardcoded default. Do not use `value || ''`: a known zero must remain visible.
|
||||
|
||||
```js
|
||||
function displayUSD(value) {
|
||||
if (value === null || value === undefined || value === '') return '';
|
||||
const amount = Number(value);
|
||||
if (!Number.isFinite(amount)) return '';
|
||||
const rounded = Math.round(amount);
|
||||
return `${rounded < 0 ? '-' : ''}$${Math.abs(rounded).toLocaleString('ru-RU')}`;
|
||||
}
|
||||
```
|
||||
|
||||
`displayUSD(13320.4)` renders `$13 320`; `displayUSD(0)` renders `$0`.
|
||||
Table cells use `text-align: right; font-variant-numeric: tabular-nums`.
|
||||
For compact metrics, use a shared formatter rather than deriving an abbreviated value per page.
|
||||
Reference in new issue
Block a user