From c3326ef41af1bdd08e0c317bed8bfe6b26614cf3 Mon Sep 17 00:00:00 2001 From: Vinicius Gabriel Machado <vgm18@inf.ufpr.br> Date: Thu, 30 Sep 2021 18:42:30 -0300 Subject: [PATCH] Contrast in admin --- .../Components/Inputs/EditCollection.js | 18 +++++---- .../Components/Inputs/EditEducationalObect.js | 34 +++++++++-------- .../Components/Components/Inputs/EditUser.js | 12 ++---- .../Components/Inputs/EmailInputs.js | 34 ++++++++++++----- src/Admin/Pages/Pages/SubPages/Questions.js | 38 +++---------------- src/Admin/Pages/Pages/SubPages/SendEmail.js | 1 - 6 files changed, 60 insertions(+), 77 deletions(-) diff --git a/src/Admin/Components/Components/Inputs/EditCollection.js b/src/Admin/Components/Components/Inputs/EditCollection.js index b1fdcedc..3cba5e36 100644 --- a/src/Admin/Components/Components/Inputs/EditCollection.js +++ b/src/Admin/Components/Components/Inputs/EditCollection.js @@ -243,14 +243,16 @@ const EditCollection = () => { </MenuItem> ))} /> - <CKEditor - editor={ClassicEditor} - data={description} - onBlur={(event, editor) => { - const data = editor.getData(); - setDescription(data) - }} - /> + <div style={{color: "#666"}}> + <CKEditor + editor={ClassicEditor} + data={description} + onBlur={(event, editor) => { + const data = editor.getData(); + setDescription(data) + }} + /> + </div> </form> </CardContent> diff --git a/src/Admin/Components/Components/Inputs/EditEducationalObect.js b/src/Admin/Components/Components/Inputs/EditEducationalObect.js index 9054db98..3c4aead4 100644 --- a/src/Admin/Components/Components/Inputs/EditEducationalObect.js +++ b/src/Admin/Components/Components/Inputs/EditEducationalObect.js @@ -484,7 +484,7 @@ const EditEducationalObject = () => { index={value} onChangeIndex={handleChangeIndex} > - <TabPanel value={value} index={0} dir={theme.direction}> + <form style={{ display: "flex", flexDirection: "column" }}> {fields.map((field, index) => ( <FormInput @@ -559,20 +559,22 @@ const EditEducationalObject = () => { ))} /> </form> - </TabPanel> - - <TabPanel value={value} index={1} dir={theme.direction}> - <CKEditor - editor={ClassicEditor} - data={description} - onBlur={(event, editor) => { - const data = editor.getData(); - setDescription(data) - }} - /> - </TabPanel> - - <TabPanel value={value} index={2} dir={theme.direction}> + + + + <div style={{color: "#666"}}> + <CKEditor + editor={ClassicEditor} + data={description} + onBlur={(event, editor) => { + const data = editor.getData(); + setDescription(data) + }} + /> + </div> + + + <form style={{ display: "flex", flexDirection: "column" }}> {Imutables.map((field, index) => ( <FormInput @@ -585,7 +587,7 @@ const EditEducationalObject = () => { /> ))} </form> - </TabPanel> + </SwipeableViews> </CardContent> diff --git a/src/Admin/Components/Components/Inputs/EditUser.js b/src/Admin/Components/Components/Inputs/EditUser.js index 90490de2..fd84adb8 100644 --- a/src/Admin/Components/Components/Inputs/EditUser.js +++ b/src/Admin/Components/Components/Inputs/EditUser.js @@ -28,9 +28,9 @@ import { makeStyles } from '@material-ui/core/styles'; import SaveIcon from '@material-ui/icons/Save'; import DeleteRoundedIcon from '@material-ui/icons/DeleteRounded'; import FormControlLabel from '@material-ui/core/FormControlLabel'; -import Switch from '@material-ui/core/Switch'; import AddRoundedIcon from '@material-ui/icons/AddRounded'; import MenuItem from '@material-ui/core/MenuItem'; + //imports local files import SnackBar from '../../../../Components/SnackbarComponent'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; @@ -38,6 +38,7 @@ import { StyledCard } from "../../../Components/Styles/DataCard"; import { Store } from 'Store' import FormInput from "Components/FormInput.js" import StyledButton from '../Button'; +import { BlueCheckBox, ContrastCheckBox } from "./EmailInputs.js" //imports services import { getRequest, putRequest, deleteRequest, postRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import { EditFilter, GetAData } from '../../../Filters'; @@ -567,14 +568,7 @@ const EditUser = () => { ))} /> <FormControlLabel - control={ - <Switch - checked={switchState} - onChange={() => { setSwitchState(!switchState) }} - name="checkedB" - color="primary" - /> - } + control={state.contrast === "" ? <BlueCheckBox checked={switchState} onChange={() => { setSwitchState(!switchState) }} name="checkedB"/> : <ContrastCheckBox checked={switchState} onChange={() => { setSwitchState(!switchState) }} name="checkedB"/>} label="Concorda com os termos de serviço?" /> </form> diff --git a/src/Admin/Components/Components/Inputs/EmailInputs.js b/src/Admin/Components/Components/Inputs/EmailInputs.js index 2ce92580..0a5df002 100644 --- a/src/Admin/Components/Components/Inputs/EmailInputs.js +++ b/src/Admin/Components/Components/Inputs/EmailInputs.js @@ -24,8 +24,9 @@ import FormControlLabel from "@material-ui/core/FormControlLabel"; import CircularProgress from "@material-ui/core/CircularProgress"; import Checkbox from "@material-ui/core/Checkbox"; import SendRoundedIcon from "@material-ui/icons/SendRounded"; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles, withStyles } from '@material-ui/core/styles'; import Chip from '@material-ui/core/Chip'; +import { yellow, blue } from "@material-ui/core/colors"; //imports from local files import SnackBar from "../../../../Components/SnackbarComponent"; import { postRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' @@ -49,6 +50,26 @@ const useStyles = makeStyles((theme) => ({ }, })); +export const BlueCheckBox = withStyles({ + root: { + color: blue[400], + '&$checked': { + color: blue[600], + }, + }, + checked: {}, +})((props) => <Checkbox color="default" {...props} />); + +export const ContrastCheckBox = withStyles({ + root: { + color: yellow[400], + '&$checked': { + color: yellow[600], + }, + }, + checked: {}, +})((props) => <Checkbox color="default" {...props} />); + const EmailInputs = (props) => { const { state } = useContext(Store); @@ -407,14 +428,7 @@ const EmailInputs = (props) => { {roles.map((role, index) => ( <FormControlLabel key={index} - control={ - <Checkbox - checked={role.isChecked} - onChange={() => handleChangeCheckBox(index)} - name={role.label} - color="primary" - /> - } + control={props.contrast === "" ? <BlueCheckBox checked={role.isChecked} onChange={() => handleChangeCheckBox(index)} name={role.label}/> : <ContrastCheckBox checked={role.isChecked} onChange={() => handleChangeCheckBox(index)} name={role.label}/>} label={role.label} /> ))} @@ -471,7 +485,7 @@ const EmailInputs = (props) => { <div style={{ height: "1em" }} /> - <div style={{ flex: 1 }}> + <div style={{ flex: 1, color: "#666" }}> <CKEditor editor={ClassicEditor} data={message} diff --git a/src/Admin/Pages/Pages/SubPages/Questions.js b/src/Admin/Pages/Pages/SubPages/Questions.js index 0bb7416b..7a9f110f 100644 --- a/src/Admin/Pages/Pages/SubPages/Questions.js +++ b/src/Admin/Pages/Pages/SubPages/Questions.js @@ -29,6 +29,7 @@ import MobilePageHeader from "../../../Components/Components/MobileComponents/Mo import PageHeader from "../../../Components/Components/PageHeader" import { StyledLoadMoreButton, StyledDivButton, useStylesCell, useStylesRow } from './Collections'; import { Store } from 'Store' +import { BlueCheckBox, ContrastCheckBox } from "../../../Components/Components/Inputs/EmailInputs" //imports from material ui import TableBody from '@material-ui/core/TableBody'; import TableCell from '@material-ui/core/TableCell'; @@ -37,7 +38,6 @@ import { Button } from '@material-ui/core'; import CircularProgress from '@material-ui/core/CircularProgress'; import AddRoundedIcon from '@material-ui/icons/AddRounded'; import UpdateRoundedIcon from '@material-ui/icons/UpdateRounded'; -import Switch from '@material-ui/core/Switch'; //router import { useHistory } from 'react-router-dom'; import HelpRoundedIcon from "@material-ui/icons/HelpRounded"; @@ -279,21 +279,7 @@ const Questions = () => { { title: "Status", subtitle: - row.status === 'active' ? - <Switch - checked={true} - onChange={() => handleChange(index, row.status)} - name="checkedB" - color="primary" - /> - : - - <Switch - checked={false} - onChange={() => handleChange(index, row.status)} - name="checkedB" - color="primary" - /> + state.contrast === "" ? <BlueCheckBox checked={row.status === "active"} onChange={() => handleChange(index, row.status)} name="checkedB"/> : <ContrastCheckBox checked={row.status === "active"} onChange={() => handleChange(index, row.status)} name="checkedB"/> }, { title: "Atualizado em", @@ -382,23 +368,9 @@ const Questions = () => { <TableCell className={classesCell.root} align="right">{DisplayDate(row.created_at)}</TableCell > <TableCell className={classesCell.root} align="right">{row.description}</TableCell > <TableCell className={classesCell.root} align="right"> - { - row.status === 'active' ? - <Switch - checked={true} - onChange={() => handleChange(index, row.status)} - name="checkedB" - color="primary" - /> - : - - <Switch - checked={false} - onChange={() => handleChange(index, row.status)} - name="checkedB" - color="primary" - /> - } + { + state.contrast === "" ? <BlueCheckBox checked={row.status === "active"} onChange={() => handleChange(index, row.status)} name="checkedB"/> : <ContrastCheckBox checked={row.status === "active"} onChange={() => handleChange(index, row.status)} name="checkedB"/> + } </TableCell > <TableCell className={classesCell.root} align="right">{DisplayDate(row.updated_at)}</TableCell > </TableRow> diff --git a/src/Admin/Pages/Pages/SubPages/SendEmail.js b/src/Admin/Pages/Pages/SubPages/SendEmail.js index a5a4a940..92db3b65 100644 --- a/src/Admin/Pages/Pages/SubPages/SendEmail.js +++ b/src/Admin/Pages/Pages/SubPages/SendEmail.js @@ -56,7 +56,6 @@ const useStyles = makeStyles({ }, }); - const SendEmail = ({ match }) => { const { state } = useContext(Store); -- GitLab