Skip to content

Commit

Permalink
chore: Change color of radio buttons if disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
sashko9807 committed Dec 6, 2024
1 parent eadb031 commit 290aec4
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/components/common/form/RadioButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,29 @@ type RadioButtonProps = {
error?: boolean
}

function RadioButton({ checked, label, muiRadioButtonProps, value, error }: RadioButtonProps) {
function RadioButton({
checked,
label,
muiRadioButtonProps,
value,
disabled,
error,
}: RadioButtonProps) {
return (
<StyledRadioButton error={error}>
<FormControlLabel
value={value}
className={`${classes.radioWrapper} ${checked ? classes.checked : null}`}
sx={checked ? {} : undefined}
disabled={disabled}
sx={disabled ? { backgroundColor: '#e0e0e0', opacity: 0.7 } : {}}
className={`${classes.radioWrapper} ${checked && !disabled ? classes.checked : null}`}
label={
<Typography className={classes.label} sx={{ wordBreak: 'break-word' }}>
{label}
</Typography>
}
control={
<Radio
disabled={disabled}
icon={<div className={`${classes.circle}`} />}
checkedIcon={
<Check color="primary" className={checked ? classes.checkIcon : undefined} />
Expand Down

0 comments on commit 290aec4

Please sign in to comment.