import { Switch, SxProps, Theme } from '@mui/material'; import { FC, useMemo } from 'react'; import { GREY } from '../lib/consts/DEFAULT_THEME'; import FlexBox from './FlexBox'; import { BodyText } from './Text'; const SwitchWithLabel: FC = ({ checked: isChecked, flexBoxProps: { sx: flexBoxSx, ...restFlexBoxProps } = {}, id: switchId, label, name: switchName, onChange, switchProps, }) => { const combinedFlexBoxSx = useMemo>( () => ({ '& > :first-child': { flexGrow: 1, }, ...flexBoxSx, }), [flexBoxSx], ); const labelElement = useMemo( () => typeof label === 'string' ? ( {label} ) : ( label ), [label], ); return ( {labelElement} ); }; export default SwitchWithLabel;