fix(striker-ui): enable dataset in SwitchWithLabel

main
Tsu-ba-me 2 years ago
parent cd14783c08
commit c20100ab74
  1. 41
      striker-ui/components/SwitchWithLabel.tsx
  2. 1
      striker-ui/types/SwitchWithLabel.d.ts

@ -16,6 +16,7 @@ const SwitchFormControlLabel = styled(MUIFormControlLabel)({
});
const SwitchWithLabel: FC<SwitchWithLabelProps> = ({
baseInputProps,
checked: isChecked,
formControlLabelProps,
id: switchId,
@ -37,22 +38,30 @@ const SwitchWithLabel: FC<SwitchWithLabelProps> = ({
);
return (
<SwitchFormControlLabel
componentsProps={{ typography: { flexGrow: 1 } }}
control={
<MUISwitch
checked={isChecked}
edge="end"
id={switchId}
name={switchName}
onChange={onChange}
{...switchProps}
/>
}
label={labelElement}
labelPlacement="start"
{...formControlLabelProps}
/>
<>
<SwitchFormControlLabel
componentsProps={{ typography: { flexGrow: 1 } }}
control={
<MUISwitch
checked={isChecked}
edge="end"
name={switchName}
onChange={onChange}
{...switchProps}
/>
}
label={labelElement}
labelPlacement="start"
{...formControlLabelProps}
/>
<input
checked={isChecked}
hidden
id={switchId}
readOnly
{...baseInputProps}
/>
</>
);
};

@ -1,4 +1,5 @@
type SwitchWithLabelOptionalProps = {
baseInputProps?: import('@mui/material').InputBaseComponentProps;
formControlLabelProps?: import('@mui/material').FormControlLabelProps;
switchProps?: import('@mui/material').SwitchProps;
};

Loading…
Cancel
Save