浏览代码

render style improve

amenpunk 2 年之前
父节点
当前提交
52b816c09a
共有 3 个文件被更改,包括 24 次插入50 次删除
  1. 3 0
      src/App.css
  2. 17 43
      src/Components/Test/Cleaver/Question.jsx
  3. 4 7
      src/Pages/Pruebas/Cleaver.jsx

+ 3 - 0
src/App.css

@@ -327,3 +327,6 @@
327 327
   padding-bottom:35px;
328 328
   margin-bottom:35px;
329 329
 }
330
+.nextquestion_btn:hover{
331
+  background-color: var(--main) !important;
332
+}

+ 17 - 43
src/Components/Test/Cleaver/Question.jsx

@@ -1,29 +1,22 @@
1 1
 import * as React from 'react';
2 2
 
3
-import Card from '@mui/material/Card';
4
-// import CardActions from '@mui/material/CardActions';
5
-import CardContent from '@mui/material/CardContent';
6
-// import Button from '@mui/material/Button';
7
-// import Typography from '@mui/material/Typography';
8
-// import Avatar from '@mui/material/Avatar';
9
-import Checkbox from '@mui/material/Checkbox';
10
-// import { deepPurple } from '@mui/material/colors';
3
+import { 
4
+  Remove as RemoveIcon,
5
+  Add as AddIcon
6
+} from '@mui/icons-material';
11 7
 
12
-import List from '@mui/material/List';
13
-import Tooltip from '@mui/material/Tooltip';
14
-import ListItem from '@mui/material/ListItem';
15
-import ListItemButton from '@mui/material/ListItemButton';
16
-import ListItemIcon from '@mui/material/ListItemIcon';
17
-import ListItemText from '@mui/material/ListItemText';
18
-
19
-import AddIcon from '@mui/icons-material/Add';
20
-import RemoveIcon from '@mui/icons-material/Remove';
8
+import {
9
+  Card,CardContent,Avatar,Checkbox,List,Tooltip,
10
+  ListItem,ListItemButton,ListItemIcon,ListItemText
11
+} from '@mui/material'
21 12
 
13
+import { deepPurple } from '@mui/material/colors';
22 14
 
23 15
 function CheckboxexHeader(prop) {
24 16
   return (
25 17
     <List sx={{ width: '100%', bgcolor: 'background.paper' }}>
26 18
       <ListItem>
19
+        <Avatar sx={{ bgcolor: deepPurple[500] }}>{prop.group}</Avatar>
27 20
         <ListItemButton role={undefined} dense>
28 21
           <ListItemText style={{marginRight :25, color:'silver'}} primary={prop.title} />
29 22
           <ListItemIcon>
@@ -62,9 +55,11 @@ function CheckboxesGroup(props) {
62 55
         return (
63 56
           <ListItem key={value.id}>
64 57
             <ListItemButton role={undefined} onClick={handleToggle(value)} dense>
65
-
66 58
               <Tooltip title={value.decription} placement="top-start" arrow>
67
-                <ListItemText className="checkbox_label_question" id={labelId} primary={value.nombre} />
59
+                <ListItemText 
60
+                  sx={{ '& .MuiTypography-root' : {
61
+                      fontWeight:'bold'
62
+                  }}} className="checkbox_label_question" id={labelId} primary={value.nombre} />
68 63
               </Tooltip>
69 64
 
70 65
               <ListItemIcon>
@@ -93,40 +88,19 @@ function CheckboxesGroup(props) {
93 88
   );
94 89
 }
95 90
 
96
-export function Question({ quiz, group }) {
97
-  // console.log('quiz: ', quiz)
98
-  let { instrucciondepregunta, respuestas } = quiz
91
+export function Question({ quiz}) {
92
+  let { instrucciondepregunta, respuestas,id } = quiz
99 93
   return (
100
-
101 94
     <Card sx={{ minWidth: 275, margin: '30px !important', borderLeft: '5px solid var(--main)'}}>
102 95
       <CardContent>
103 96
 
104
-        {/*
105
-        <div sx={{ fontSize: 17 }}>
106
-          <div className="quiz_title_text">
107
-            <Avatar sx={{ bgcolor: deepPurple[500] }}>{id}</Avatar>
108
-            <Typography style={{ paddingLeft: 15 }}>
109
-              {instrucciondepregunta}
110
-            </Typography>
111
-          </div>
112
-        </div>
113
-      */}
114
-
115 97
         <div variant="body2">
116 98
           <List>
117
-            <CheckboxexHeader title={group + " - " + instrucciondepregunta}/>
99
+            <CheckboxexHeader  group={id} title={instrucciondepregunta}/>
118 100
           </List>
119 101
           <CheckboxesGroup quiz={respuestas} />
120 102
         </div>
121 103
       </CardContent>
122
-
123
-        {/*
124
-      <CardActions>
125
-        <Button variant="contained" size="small">Anterior</Button>
126
-        <Button variant="contained" size="small">Siguiente</Button>
127
-      </CardActions>
128
-      */}
129
-
130 104
     </Card>
131 105
   );
132 106
 }

+ 4 - 7
src/Pages/Pruebas/Cleaver.jsx

@@ -1,13 +1,8 @@
1 1
 import React, { useMemo } from 'react'
2
-
3 2
 import { Service } from '../../Utils/HTTP'
4 3
 import useAuth from '../../Auth/useAuth.js';
5 4
 import { Question } from '../../Components/Test/Cleaver/Question.jsx'
6
-
7
-import Box from '@mui/material/Box';
8
-import Button from '@mui/material/Button';
9
-import Collapse from '@mui/material/Collapse';
10
-import List from '@mui/material/List';
5
+import { Box,Button, Collapse, List } from '@mui/material'
11 6
 import { TransitionGroup } from 'react-transition-group';
12 7
 import * as Scroll from 'react-scroll';
13 8
 
@@ -56,7 +51,7 @@ var scroll = Scroll.animateScroll;
56 51
             <TransitionGroup >
57 52
               {totalRespondidas.map((item) => (
58 53
                 <Collapse key={item.id} >
59
-                  <Question key={item.id} quiz={item} group={item.nombre}/>
54
+                  <Question key={item.id} id={item.id} quiz={item} />
60 55
                 </Collapse>
61 56
               ))
62 57
             }
@@ -66,6 +61,8 @@ var scroll = Scroll.animateScroll;
66 61
 
67 62
         <div className="question_btn">
68 63
         <Button
64
+          className="nextquestion_btn"
65
+          sx={{ backgroundColor: 'var(--main)' }}
69 66
           variant="contained"
70 67
           disabled={totalPreguntas.length <= 0}
71 68
           onClick={handleAddQuestion}