UNPKG

@lunit/oui

Version:

Lunit Oncology UI components

52 lines (51 loc) 1.92 kB
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: [{ display: 'flex', overflowY: 'auto' }, background ? { padding: '8px 6px 8px 16px' } : { padding: 0 }, background ? { borderRadius: '8px' } : { borderRadius: 0 }, background ? { backgroundColor: theme.palette.neutralGrey[75] } : { backgroundColor: 'transparent' }, height ? { height: height } : { height: 'auto' }], children: _jsx(PresentationTypography, { size: size, sx: [{ display: 'block', whiteSpace: 'pre-wrap', overflow: 'auto', '&::-webkit-scrollbar': { width: '12px', }, '&::-webkit-scrollbar-thumb': { width: '6px', backgroundColor: theme.palette.neutralGrey[65], borderRadius: '6px', } }, background ? { color: '#FFFFFF' } : { color: 'inherit' }, height ? { height: '100%' } : { height: 'auto' }], children: content }) })); }; export default FreeText;