import type { FC, PropsWithChildren, ReactNode } from "react"; import { Paper, Stack, Text, VisuallyHidden } from "@mantine/core"; import { useTranslation } from "react-i18next"; import { formatMoney } from "@/shared/lib"; import classes from "./EntryGroup.module.css"; type AccountRowProps = { accountName: string; tone?: "negative" | "neutral" | "positive"; value: string; valueLabel: string; }; type EntryGroupProps = PropsWithChildren<{ flat?: boolean; header: ReactNode; label: string; }>; type EntryGroupTotalProps = { isSigned?: boolean; totals: null | { currency: string; value: string }[]; }; const AccountRow: FC = (props) => { const accessibleName = `${props.accountName}, ${props.value}`; const valueClass = props.tone ? classes[props.tone] : undefined; return (
  • {props.accountName} {props.value} {props.valueLabel}
  • ); }; const AccountCardRow: FC = props => (
  • {props.accountName} {props.value} {props.valueLabel}
  • ); const EntryGroup: FC = (props) => { const groupClass = props.flat ? `${classes.group} ${classes.flat}` : classes.group; return ( {props.header} {props.children} ); }; const EntryGroupTotal: FC = (props) => { const { t } = useTranslation(); if (!props.totals) { return {t("entryGroup.totalUnavailable")}; } const isSigned = props.isSigned === true; return ( {props.totals.map(total => ( {formatMoney(total, { withSign: isSigned || undefined })} ))} ); }; export { AccountCardRow, AccountRow, EntryGroup, EntryGroupTotal, };