Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | import { css } from '@emotion/react'; import { isNil } from 'lodash-es'; import { memo, type ReactNode } from 'react'; import { Skeleton, Typography } from '@allshares/studio-design-system'; import { type CurrencySymbolsEnum } from '@amalia/ext/iso-4217'; import { useFormatAmount } from '@amalia/kernel/intl/components'; export type PaymentsMetricProps = { readonly label: ReactNode; readonly value?: number; readonly currency: CurrencySymbolsEnum; readonly isLoading: boolean; }; export const PaymentsMetric = memo(function PaymentsMetric({ label, value = 0, currency, isLoading, }: PaymentsMetricProps) { const formatAmount = useFormatAmount(); const formattedValue = isNil(value) ? '-' : formatAmount(value, currency); return ( <div css={(theme) => css` padding: 24px 40px; display: flex; flex-direction: column; gap: 2px; min-height: 110px; flex: 1; * + & { border-left: 1px solid ${theme.ds.colors.gray[100]}; } [data-color-scheme='dark'] & { border-color: ${theme.ds.colors.dark[600]}; } `} > <Skeleton visible={isLoading}> <Typography variant="heading3Medium">{formattedValue}</Typography> <Typography variant="bodySmallMedium">{label}</Typography> </Skeleton> </div> ); }); |