added ui when richtext is required

This commit is contained in:
ronronscelestes 2022-01-05 17:26:14 +01:00
parent 0c14a06979
commit 01190a00b5

View File

@ -26,6 +26,10 @@ const LabelAction = styled(Box)`
} }
`; `;
const TypographyAsterisk = styled(Typography)`
line-height: 0;
`;
const Wysiwyg = ({ const Wysiwyg = ({
description, description,
disabled, disabled,
@ -36,6 +40,7 @@ const Wysiwyg = ({
onChange, onChange,
placeholder, placeholder,
value, value,
required,
}) => { }) => {
const { formatMessage } = useIntl(); const { formatMessage } = useIntl();
const textareaRef = useRef(null); const textareaRef = useRef(null);
@ -124,6 +129,7 @@ const Wysiwyg = ({
<Stack horizontal size={1}> <Stack horizontal size={1}>
<Typography variant="pi" fontWeight="bold" textColor="neutral800"> <Typography variant="pi" fontWeight="bold" textColor="neutral800">
{label} {label}
{required && <TypographyAsterisk textColor="danger600">*</TypographyAsterisk>}
</Typography> </Typography>
{labelAction && <LabelAction paddingLeft={1}>{labelAction}</LabelAction>} {labelAction && <LabelAction paddingLeft={1}>{labelAction}</LabelAction>}
</Stack> </Stack>
@ -182,6 +188,7 @@ Wysiwyg.defaultProps = {
error: '', error: '',
labelAction: undefined, labelAction: undefined,
placeholder: null, placeholder: null,
required: false,
value: '', value: '',
}; };
@ -206,6 +213,7 @@ Wysiwyg.propTypes = {
defaultMessage: PropTypes.string.isRequired, defaultMessage: PropTypes.string.isRequired,
values: PropTypes.object, values: PropTypes.object,
}), }),
required: PropTypes.bool,
value: PropTypes.string, value: PropTypes.string,
}; };