design improvements

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-02-28 10:19:37 +01:00
parent ee2ccbaa98
commit 3679caf547
22 changed files with 581 additions and 349 deletions

View File

@@ -30,5 +30,26 @@ export function useNumber() {
return {
format,
short,
shortWithUnit: (value: number | null | undefined, unit?: string | null) => {
if (isNil(value)) {
return 'N/A';
}
if (unit === 'min') {
return fancyMinutes(value);
}
return `${short(value)}${unit ? ` ${unit}` : ''}`;
},
formatWithUnit: (
value: number | null | undefined,
unit?: string | null
) => {
if (isNil(value)) {
return 'N/A';
}
if (unit === 'min') {
return fancyMinutes(value);
}
return `${format(value)}${unit ? ` ${unit}` : ''}`;
},
};
}