// ** MUI Imports import Box from '@mui/material/Box' import Grid from '@mui/material/Grid' import Radio from '@mui/material/Radio' import Typography from '@mui/material/Typography' // ** Type Imports import { CustomRadioBasicProps } from 'src/@core/components/custom-radio/types' const CustomRadioBasic = (props: CustomRadioBasicProps) => { // ** Props const { name, data, selected, gridProps, handleChange, color = 'primary' } = props const { meta, title, value, content } = data const renderData = () => { if (meta && title && content) { return ( {typeof title === 'string' ? {title} : title} {typeof meta === 'string' ? {meta} : meta} {typeof content === 'string' ? {content} : content} ) } else if (meta && title && !content) { return ( {typeof title === 'string' ? {title} : title} {typeof meta === 'string' ? {meta} : meta} ) } else if (!meta && title && content) { return ( {typeof title === 'string' ? {title} : title} {typeof content === 'string' ? {content} : content} ) } else if (!meta && !title && content) { return typeof content === 'string' ? {content} : content } else if (!meta && title && !content) { return typeof title === 'string' ? {title} : title } else { return null } } const renderComponent = () => { return ( handleChange(value)} sx={{ p: 4, height: '100%', display: 'flex', borderRadius: 1, cursor: 'pointer', position: 'relative', alignItems: 'flex-start', border: theme => `1px solid ${theme.palette.divider}`, ...(selected === value ? { borderColor: `${color}.main` } : { '&:hover': { borderColor: theme => `rgba(${theme.palette.customColors.main}, 0.25)` } }) }} > {renderData()} ) } return data ? renderComponent() : null } export default CustomRadioBasic