@lunit/oui
Version:
Lunit Oncology UI components
33 lines (32 loc) • 1.43 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { Box } from '@mui/material';
import theme from '../../theme';
import { PresentationTypography } from '../presentations.styled';
const FreeText = ({ componentType = 'freeText', size = 'medium', content, height, background = false, }) => {
if (!componentType)
throw new Error("The 'componentType' prop is required.");
if (!content)
throw new Error("The 'content' prop is required.");
return (_jsx(Box, { sx: {
padding: background ? '8px 6px 8px 16px' : 0,
borderRadius: background ? '8px' : 0,
backgroundColor: background ? theme.palette.neutralGrey[75] : 'transparent',
height: height ? height : 'auto',
display: 'flex',
}, children: _jsx(PresentationTypography, { size: size, sx: {
display: 'block',
whiteSpace: 'pre-wrap',
overflow: 'auto',
color: background ? '#FFFFFF' : 'inherit',
height: height ? '100%' : 'auto',
'&::-webkit-scrollbar': {
width: '12px',
},
'&::-webkit-scrollbar-thumb': {
width: '6px',
backgroundColor: theme.palette.neutralGrey[65],
borderRadius: '6px',
},
}, children: content }) }));
};
export default FreeText;