import * as React from 'react'; import { Remove as RemoveIcon, Add as AddIcon } from '@mui/icons-material'; import { Card,CardContent,Avatar,Checkbox,List,Tooltip,Fade, ListItem,ListItemButton,ListItemIcon,ListItemText, } from '@mui/material' import { deepPurple } from '@mui/material/colors'; function CheckboxexHeader(prop) { return ( {prop.group} ); } function CheckboxesGroup(props) { let { quiz, save, responses : resp, id:index} = props; const [checkA, setCheckA] = React.useState( 0); const [checkB, setCheckB] = React.useState(0); const changeA = (event) => { let { id, checked } = event.target if(parseInt( checkB ) !== parseInt(id) && checked ){ setCheckA(parseInt( id )) let temp = { [index]: { A:id, B: resp[id]?.B ? resp[id].B : 0 } } save(Object.assign(resp,temp)) } }; const changeB = (event) => { let { id, checked } = event.target if(parseInt( checkA ) !== parseInt( id ) && checked){ setCheckB(parseInt( id )) let temp = { [index]: { B:id, A: resp[id]?.A ? resp[id].A : 0 } } save(Object.assign(resp,temp)) } }; return ( {quiz.map((value) => { // console.log("QUIZ VALUE: ", value) const labelId = `checkbox-list-label-${value.id}`; return ( ); })} ); } export function Question({quiz, index, current, save, responses}) { let { instrucciondepregunta, respuestas,id } = quiz let checked = index === current; return (
); }