From 4fe8bd6a3dc32bd82eff8143c562bdc8617eab35 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Mon, 25 Sep 2023 19:10:12 -0700 Subject: [PATCH] feat: financial statement --- libs/analytics/src/FinancialStatement.tsx | 79 ++++++++++++----------- 1 file changed, 43 insertions(+), 36 deletions(-) diff --git a/libs/analytics/src/FinancialStatement.tsx b/libs/analytics/src/FinancialStatement.tsx index 326ce2ff4..f1a2a6b47 100644 --- a/libs/analytics/src/FinancialStatement.tsx +++ b/libs/analytics/src/FinancialStatement.tsx @@ -14,9 +14,6 @@ export const FinancialStatement = (props: { columns: string[]; data: Record>>; }) => { - const theme = useTheme(); - const isMobile = useMediaQuery(theme.breakpoints.down('sm')); - const columnWeight = props.columns.length + 2; return ( - + {Object.entries(props.data).map(([title, data]) => ( + + ))} + + ); +}; + +const Header = (props: { columns: string[] }) => { + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down('sm')); + const columnWeight = props.columns.length + 2; + return ( + + theme.palette.primary.contrastText} + sx={{ backgroundColor: (theme) => theme.palette.grey[800] }} + fontSize={{ xs: '.875rem', sm: '1.125rem' }} + px={{ xs: 1, sm: 2, md: 4 }} + py={{ xs: 2, sm: 3, md: 4 }} > - theme.palette.primary.contrastText} - sx={{ backgroundColor: (theme) => theme.palette.grey[800] }} - fontSize={{ xs: '.875rem', sm: '1.125rem' }} - px={{ xs: 1, sm: 2, md: 4 }} - py={{ xs: 2, sm: 3, md: 4 }} - > - - {props.columns.map((column) => ( - - {column} - - ))} + {props.columns.map((column, index) => ( - {isMobile ? 'Diff' : 'Difference'} + {column} - - - {Object.entries(props.data).map(([title, data]) => ( -
- ))} - + ))} + + {isMobile ? 'Diff' : 'Difference'} + + + ); };