|
@@ -6,41 +6,64 @@ import CardContent from '@mui/material/CardContent';
|
6
|
6
|
import Button from '@mui/material/Button';
|
7
|
7
|
import Typography from '@mui/material/Typography';
|
8
|
8
|
import Avatar from '@mui/material/Avatar';
|
9
|
|
-// import Stack from '@mui/material/Stack';
|
10
|
|
-// import Radio from '@mui/material/Radio';
|
11
|
|
-import RadioGroup from '@mui/material/RadioGroup';
|
12
|
|
-import FormControlLabel from '@mui/material/FormControlLabel';
|
13
|
|
-import FormControl from '@mui/material/FormControl';
|
14
|
|
-// import FormLabel from '@mui/material/FormLabel';
|
15
|
9
|
import Checkbox from '@mui/material/Checkbox';
|
16
|
10
|
import { deepPurple } from '@mui/material/colors';
|
17
|
|
-const label = { inputProps: { 'aria-label': 'Checkbox demo' } };
|
18
|
11
|
|
|
12
|
+import List from '@mui/material/List';
|
|
13
|
+import ListItem from '@mui/material/ListItem';
|
|
14
|
+import ListItemButton from '@mui/material/ListItemButton';
|
|
15
|
+import ListItemIcon from '@mui/material/ListItemIcon';
|
|
16
|
+import ListItemText from '@mui/material/ListItemText';
|
19
|
17
|
|
20
|
|
-function Radio() {
|
21
|
|
- return(
|
22
|
|
- <div>
|
23
|
|
- <Checkbox {...label} defaultChecked />
|
24
|
|
- <Checkbox {...label} />
|
25
|
|
- </div>
|
26
|
|
- )
|
27
|
|
-}
|
|
18
|
+function CheckboxesGroup(props) {
|
|
19
|
+
|
|
20
|
+ const [checked, setChecked] = React.useState([0]);
|
|
21
|
+
|
|
22
|
+ const handleToggle = (value) => () => {
|
|
23
|
+ const currentIndex = checked.indexOf(value);
|
|
24
|
+ const newChecked = [...checked];
|
|
25
|
+
|
|
26
|
+ if (currentIndex === -1) {
|
|
27
|
+ newChecked.push(value);
|
|
28
|
+ } else {
|
|
29
|
+ newChecked.splice(currentIndex, 1);
|
|
30
|
+ }
|
28
|
31
|
|
|
32
|
+ setChecked(newChecked);
|
|
33
|
+ };
|
29
|
34
|
|
30
|
|
-function Response ({resp}) {
|
31
|
35
|
return (
|
32
|
|
- <FormControl>
|
33
|
|
- <RadioGroup
|
34
|
|
- aria-labelledby="demo-radio-buttons-group-label"
|
35
|
|
- defaultValue="female"
|
36
|
|
- name="radio-buttons-group"
|
37
|
|
- >
|
38
|
|
- {
|
39
|
|
- resp.map(a => <FormControlLabel value="female" control={<Radio />} label={a.nombre} />)
|
40
|
|
- }
|
41
|
|
- </RadioGroup>
|
42
|
|
- </FormControl>
|
43
|
|
- )
|
|
36
|
+ <List sx={{ width: '100%', bgcolor: 'background.paper' }}>
|
|
37
|
+ {props.quiz.map((value) => {
|
|
38
|
+ const labelId = `checkbox-list-label-${value.id}`;
|
|
39
|
+ return (
|
|
40
|
+ <ListItem key={value.id}>
|
|
41
|
+ <ListItemButton role={undefined} onClick={handleToggle(value)} dense>
|
|
42
|
+ <ListItemText id={labelId} primary={value.nombre} />
|
|
43
|
+ <ListItemIcon>
|
|
44
|
+ <Checkbox
|
|
45
|
+ edge="start"
|
|
46
|
+ checked={checked.indexOf(value) !== -1}
|
|
47
|
+ tabIndex={-1}
|
|
48
|
+ disableRipple
|
|
49
|
+ inputProps={{ 'aria-labelledby': labelId }}
|
|
50
|
+ />
|
|
51
|
+ </ListItemIcon>
|
|
52
|
+ <ListItemIcon>
|
|
53
|
+ <Checkbox
|
|
54
|
+ edge="start"
|
|
55
|
+ checked={false}
|
|
56
|
+ tabIndex={-1}
|
|
57
|
+ disableRipple
|
|
58
|
+ inputProps={{ 'aria-labelledby': labelId }}
|
|
59
|
+ />
|
|
60
|
+ </ListItemIcon>
|
|
61
|
+ </ListItemButton>
|
|
62
|
+ </ListItem>
|
|
63
|
+ );
|
|
64
|
+ })}
|
|
65
|
+ </List>
|
|
66
|
+ );
|
44
|
67
|
}
|
45
|
68
|
|
46
|
69
|
export function Question({ quiz }) {
|
|
@@ -49,24 +72,22 @@ export function Question({ quiz }) {
|
49
|
72
|
<Card sx={{ minWidth: 275, margin: 5 }}>
|
50
|
73
|
<CardContent>
|
51
|
74
|
|
52
|
|
- <Typography sx={{ fontSize: 17 }} color="text.secondary" gutterBottom>
|
|
75
|
+ <div sx={{ fontSize: 17 }}>
|
53
|
76
|
<div className="quiz_title_text">
|
54
|
77
|
<Avatar sx={{ bgcolor: deepPurple[500] }}>{id}</Avatar>
|
55
|
|
- <p style={{ paddingLeft: 15 }}>
|
|
78
|
+ <Typography style={{ paddingLeft: 15 }}>
|
56
|
79
|
{instrucciondepregunta}
|
57
|
|
- </p>
|
|
80
|
+ </Typography>
|
58
|
81
|
</div>
|
59
|
|
- </Typography>
|
60
|
|
-
|
61
|
|
-
|
62
|
|
- <Typography variant="body2">
|
63
|
|
- <Response resp={respuestas}/>
|
64
|
|
- </Typography>
|
|
82
|
+ </div>
|
65
|
83
|
|
|
84
|
+ <div variant="body2">
|
|
85
|
+ <CheckboxesGroup quiz={respuestas}/>
|
|
86
|
+ </div>
|
66
|
87
|
</CardContent>
|
67
|
88
|
|
68
|
89
|
<CardActions>
|
69
|
|
- <Button size="small">Learn More</Button>
|
|
90
|
+ <Button size="small">Siguiente Pregunta</Button>
|
70
|
91
|
</CardActions>
|
71
|
92
|
|
72
|
93
|
</Card>
|