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 5b885af
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 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}
disabled={disabled}
sx={disabled ? { backgroundColor: '#e0e0e0', opacity: 0.7 } : {}}
className={`${classes.radioWrapper} ${checked ? classes.checked : null}`}
sx={checked ? {} : undefined}
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 5b885af

Please sign in to comment.