@lunit/oui
Version:
Lunit Oncology UI components
31 lines (30 loc) • 1.06 kB
JavaScript
import { styled } from '@mui/material';
import { styles } from '../BaseTextField/BaseTextField.styled';
import { formatCSSSize } from '../BaseTextField/BaseTextField.utils';
const baseTextAreaStyle = (theme, height) => {
return {
...styles.baseTextFieldStyle(theme),
height: height ? formatCSSSize(height) : '100px',
resize: 'none',
'&::-webkit-scrollbar': {
width: '14px !important',
},
'&::-webkit-scrollbar-thumb': {
border: `4px solid ${theme.palette.neutralGrey[75]}`,
},
};
};
const BaseTextArea = styled('textarea', {
shouldForwardProp: (prop) => !['error', 'width', 'height'].includes(prop.toString()),
})(({ theme, height, error }) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let resultStyle = baseTextAreaStyle(theme, height);
if (error) {
resultStyle = {
...resultStyle,
...styles.baseTextFieldErrorStyle(theme),
};
}
return resultStyle;
});
export default BaseTextArea;