@lunit/oui
Version:
Lunit Oncology UI components
17 lines (16 loc) • 1.3 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Box } from '@mui/material';
import { Container, HorizontalStatisticContainer, VerticalStatisticContainer, } from './Statistic.styled';
import { PresentationSymbolIcon, PresentationTypography } from '../presentations.styled';
const Statistic = ({ componentType = 'statistic', title, layout = 'vertical', metrics = '', size = 'medium', symbol, color, isDimmed = false, ...rest }) => {
if (!componentType)
throw new Error("The 'componentType' prop is required.");
if (!title)
throw new Error("The 'title' prop is required.");
return (_jsx(Container, { ...rest, sx: { width: '100%' }, children: layout === 'horizontal' ? (_jsxs(HorizontalStatisticContainer, { children: [_jsxs(Box, { sx: {
display: 'flex',
alignItems: 'center',
gap: '6px',
}, children: [symbol && (_jsx(PresentationSymbolIcon, { symbol: symbol, color: color, isDimmed: isDimmed })), _jsx(PresentationTypography, { isDimmed: isDimmed, size: size, children: title })] }), _jsx(PresentationTypography, { size: size, children: metrics })] })) : (_jsx(VerticalStatisticContainer, { title: title, metrics: metrics })) }));
};
export default Statistic;