string
extendedSuffix?: string
- format?: (val: number) => string
defaultMode: Mode
enabledModes?: Mode[]
showChange?: boolean
@@ -49,9 +50,10 @@ export function DatumCardConfigurable({
label,
color,
sc,
+ scFixed = 2,
value,
extendedSuffix,
- format = (val) => val.toFixed(2),
+ valueFormat = (val) => val.toFixed(2),
defaultMode,
enabledModes = ['total', 'average', 'latest'],
isLoading,
@@ -80,9 +82,12 @@ export function DatumCardConfigurable({
}
sc={sc?.[mode] !== undefined ? new BigNumber(sc[mode]) : undefined}
+ scFixed={scFixed}
extendedSuffix={extendedSuffix}
value={
- value?.[mode] !== undefined && format ? format(value[mode]) : undefined
+ value?.[mode] !== undefined && valueFormat
+ ? valueFormat(value[mode])
+ : undefined
}
comment={
sc ? (
@@ -111,7 +116,7 @@ export function DatumCardConfigurable({
format(val.toNumber())}
+ format={(val) => valueFormat(val.toNumber())}
value={new BigNumber(value.diff)}
/>
{showChange && value.change !== undefined && (
diff --git a/libs/design-system/src/components/DatumCard.tsx b/libs/design-system/src/components/DatumCard.tsx
index 94332c60c..79bfb1d7e 100644
--- a/libs/design-system/src/components/DatumCard.tsx
+++ b/libs/design-system/src/components/DatumCard.tsx
@@ -20,6 +20,7 @@ type Props = {
entityType?: EntityType
entityValue?: string
sc?: BigNumber
+ scFixed?: number
sf?: number
comment?: React.ReactNode
commentTip?: React.ReactNode
@@ -39,6 +40,7 @@ export function DatumCard({
extendedSuffix,
hash,
sc,
+ scFixed = 2,
sf,
comment,
commentTip,
@@ -77,7 +79,7 @@ export function DatumCard({
scaleSize={scaleSize}
variant="value"
value={sc}
- fixed={0}
+ fixed={scFixed}
/>
)}
{sf !== undefined && (