// ** MUI Imports
import Box from '@mui/material/Box'
import Grid from '@mui/material/Grid'
import Checkbox from '@mui/material/Checkbox'
import Typography from '@mui/material/Typography'
// ** Type Imports
import { CustomCheckboxBasicProps } from 'src/@core/components/custom-checkbox/types'
const CustomCheckbox = (props: CustomCheckboxBasicProps) => {
// ** Props
const { data, name, 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.includes(value)
? { borderColor: `${color}.main` }
: { '&:hover': { borderColor: theme => `rgba(${theme.palette.customColors.main}, 0.25)` } })
}}
>
handleChange(value)}
sx={{ mb: -2, mt: -1.75, ml: -1.75 }}
/>
{renderData()}
)
}
return data ? renderComponent() : null
}
export default CustomCheckbox