diff --git a/src/Admin/Components/Components/Button.js b/src/Admin/Components/Components/Button.js new file mode 100644 index 0000000000000000000000000000000000000000..ac542554d94dadd9eeac7364150bd46752acabb5 --- /dev/null +++ b/src/Admin/Components/Components/Button.js @@ -0,0 +1,46 @@ +import React, { useContext } from 'react'; +import styled from 'styled-components'; +import Button from '@material-ui/core/Button'; +import { Store } from 'Store'; + + +function ButtonComponent({ text, color, icon, variant, onClick, disabled }) { + const { state } = useContext(Store); + + if (state.contrast === "") { + return ( + <Button + startIcon={icon} + color={color} + variant={variant} + onClick={onClick} + disabled={disabled} + > + {text} + </Button> + ) + } + else { + return ( + <ContrastButton + startIcon={icon} + onClick={onClick} + disabled={disabled} + > + {text} + </ContrastButton> + ); + } +} + +const ContrastButton = styled(Button)` + background-color: black !important; + border: 1px solid white !important; + color: yellow !important; + text-decoration: underline !important; + :hover { + background-color: rgba(255,255,0,0.24) !important; + } + ` + +export default ButtonComponent diff --git a/src/Admin/Components/Components/DataCards/ActivityCard.js b/src/Admin/Components/Components/DataCards/ActivityCard.js index 6cf4be1116eead8b66f6dd76ac77b3597a98ec53..be4ef88c052a123827601b83741621bb42e81c43 100644 --- a/src/Admin/Components/Components/DataCards/ActivityCard.js +++ b/src/Admin/Components/Components/DataCards/ActivityCard.js @@ -30,6 +30,7 @@ import { GetAData } from "../../../Filters"; import { getRequest } from '../../../../Components/HelperFunctions/getAxiosConfig'; import { Link } from 'react-router-dom' import LoadingSpinner from '../../../../Components/LoadingSpinner'; +import StyledButton from '../Button'; import { Store } from 'Store' @@ -115,13 +116,12 @@ const ActivityCard = () => { </Grid> <Grid item> <Link style={{ textDecoration: 'none' }} to={`/admin/activities`}> - <Button - startIcon={<ListRoundedIcon />} + <StyledButton + icon={<ListRoundedIcon />} color="primary" variant="outlined" - > - Listar - </Button> + text="Listar" + /> </Link> </Grid> </Grid> diff --git a/src/Admin/Components/Components/DataCards/CollectionCard.js b/src/Admin/Components/Components/DataCards/CollectionCard.js index 402caaf1a7fd186df1c796e5dabaf1528fd8a126..7929d26077128ac44887bd8f579886ff8c5c090b 100644 --- a/src/Admin/Components/Components/DataCards/CollectionCard.js +++ b/src/Admin/Components/Components/DataCards/CollectionCard.js @@ -21,7 +21,6 @@ import moment from 'moment'; // Maerial ui components import CardContent from "@material-ui/core/CardContent"; import Typography from "@material-ui/core/Typography"; -import Button from "@material-ui/core/Button"; import ListRoundedIcon from "@material-ui/icons/ListRounded"; import { useStyles, StyledCard } from "../../Styles/DataCard"; import Grid from '@material-ui/core/Grid'; @@ -34,7 +33,7 @@ import { Link, useHistory } from 'react-router-dom' import LoadingSpinner from '../../../../Components/LoadingSpinner'; import SnackBar from '../../../../Components/SnackbarComponent'; import { getRequest, deleteRequest } from '../../../../Components/HelperFunctions/getAxiosConfig'; - +import StyledButton from '../Button'; import { Store } from 'Store' const CollectionCard = () => { @@ -174,33 +173,30 @@ const CollectionCard = () => { </Grid> <Grid item> <Link style={{ textDecoration: 'none' }} to={`/admin/Collections`}> - <Button - startIcon={<ListRoundedIcon />} + <StyledButton + icon={<ListRoundedIcon />} color="primary" variant="outlined" - > - Listar - </Button> + text="Listar" + /> </Link> <Link style={{ textDecoration: 'none' }} to={`/admin/EditCollection?collection=${item.id}`}> - <Button - startIcon={<EditRoundedIcon />} + <StyledButton + icon={<EditRoundedIcon />} color="primary" variant="outlined" - > - Editar - </Button> + text="Editar" + /> </Link> - <Button - startIcon={<DeleteRoundedIcon />} + <StyledButton + icon={<DeleteRoundedIcon />} color="secondary" variant="outlined" + text="Deletar" onClick={DeleteHandler} - > - Deletar - </Button> + /> </Grid> </Grid> <div style={{ height: "1em" }} /> diff --git a/src/Admin/Components/Components/DataCards/CommunityQuestionCard.js b/src/Admin/Components/Components/DataCards/CommunityQuestionCard.js index 92512fb2b7c449a0264adf7631cf5a0447d29475..b9b368d061275afbc2d4f41e3c10f9c465c5225c 100644 --- a/src/Admin/Components/Components/DataCards/CommunityQuestionCard.js +++ b/src/Admin/Components/Components/DataCards/CommunityQuestionCard.js @@ -22,7 +22,6 @@ import moment from 'moment'; import Grid from "@material-ui/core/Grid"; import CardContent from "@material-ui/core/CardContent"; import Typography from "@material-ui/core/Typography"; -import Button from "@material-ui/core/Button"; import ListRoundedIcon from "@material-ui/icons/ListRounded"; import { useStyles, StyledCard } from "../../Styles/DataCard"; // Icons @@ -32,6 +31,7 @@ import { GetAData } from "../../../Filters"; import { Link } from 'react-router-dom' import { getRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import LoadingSpinner from '../../../../Components/LoadingSpinner'; +import StyledButton from '../Button'; import { Store } from 'Store' @@ -87,14 +87,14 @@ const CommunityQuestions = () => { subTitle: "Email", prop: item.email ? - <Link to={`/admin/sendEmail/?email=${item.email}`} style={state.contrast === "" ? {textDecoration: "none"} : {textDecoration: "yellow underline", color: "yellow"}}> - <Button + <Link to={`/admin/sendEmail/?email=${item.email}`} style={state.contrast === "" ? { textDecoration: "none" } : { textDecoration: "yellow underline", color: "yellow" }}> + <StyledButton variant='text' color='inherit' - startIcon={<EmailRoundedIcon style={{color: state.contrast === "" ? "" : "white"}}/>} + icon={<EmailRoundedIcon style={{ color: state.contrast === "" ? "" : "white" }} />} + text={item.email} > - {item.email} - </Button> + </StyledButton> </Link> : null }, { @@ -118,13 +118,12 @@ const CommunityQuestions = () => { </Grid> <Grid> <Link style={{ textDecoration: 'none' }} to={`/admin/CommunityQuestions`}> - <Button - startIcon={<ListRoundedIcon />} + <StyledButton + icon={<ListRoundedIcon />} color="primary" variant="outlined" - > - Listar - </Button> + text="Listar" + /> </Link> </Grid> </Grid> diff --git a/src/Admin/Components/Components/DataCards/InstitutionsCard.js b/src/Admin/Components/Components/DataCards/InstitutionsCard.js index 5819713b002c7718b47e686543cbac11b8012e4b..cf8b6da438e28fd749f4cd56b827b591dfca73dd 100644 --- a/src/Admin/Components/Components/DataCards/InstitutionsCard.js +++ b/src/Admin/Components/Components/DataCards/InstitutionsCard.js @@ -21,7 +21,6 @@ import moment from 'moment' // Maerial ui components import CardContent from "@material-ui/core/CardContent"; import Typography from "@material-ui/core/Typography"; -import Button from "@material-ui/core/Button"; import ListRoundedIcon from "@material-ui/icons/ListRounded"; import { useStyles, StyledCard } from "../../Styles/DataCard"; import Grid from '@material-ui/core/Grid'; @@ -34,6 +33,7 @@ import { getRequest, deleteRequest } from '../../../../Components/HelperFunction import { Link, useHistory } from 'react-router-dom'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; import SnackBar from '../../../../Components/SnackbarComponent'; +import StyledButton from '../Button'; import { Store } from 'Store' @@ -173,33 +173,30 @@ const InstitutionCard = () => { </Grid> <Grid item> <Link style={{ textDecoration: 'none' }} to={`/admin/institutions`}> - <Button - startIcon={<ListRoundedIcon />} + <StyledButton + icon={<ListRoundedIcon />} color="primary" variant="outlined" - > - Listar - </Button> + text="Listar" + /> </Link> <Link style={{ textDecoration: 'none' }} to={`/admin/institutionEdit?institution=${item.id}`}> - <Button - startIcon={<EditRoundedIcon />} + <StyledButton + icon={<EditRoundedIcon />} color="primary" variant="outlined" - > - Editar - </Button> + text="Editar" + /> </Link> - <Button - startIcon={<DeleteRoundedIcon />} + <StyledButton + icon={<DeleteRoundedIcon />} color="secondary" variant="outlined" onClick={DeleteHandler} - > - Deletar - </Button> + text="Deletar" + /> </Grid> </Grid> <div style={{ height: "1em" }} /> diff --git a/src/Admin/Components/Components/Inputs/EditCollection.js b/src/Admin/Components/Components/Inputs/EditCollection.js index 26999ce2818fca4789dbb24bb9f14044ea66ba6c..25af11cf7a9ca1f25b727e55cff27094534bb61c 100644 --- a/src/Admin/Components/Components/Inputs/EditCollection.js +++ b/src/Admin/Components/Components/Inputs/EditCollection.js @@ -18,7 +18,7 @@ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/> import React, { useState, useEffect, useContext } from 'react'; //imports material ui components -import { Typography, TextField, Button, Grid } from '@material-ui/core'; +import { Typography, TextField, Grid } from '@material-ui/core'; import CircularProgress from '@material-ui/core/CircularProgress'; import CardContent from "@material-ui/core/CardContent"; import CardAction from '@material-ui/core/CardActions'; @@ -33,6 +33,7 @@ import { EditFilter, GetAData } from '../../../Filters'; import { StyledCard } from "../../../Components/Styles/DataCard"; import { Store } from 'Store' import FormInput from "Components/FormInput.js" +import StyledButton from '../Button'; //routers import { Link } from 'react-router-dom'; import ClassicEditor from "@ckeditor/ckeditor5-build-classic" @@ -195,13 +196,12 @@ const EditCollection = () => { </Grid> <Grid item> <Link style={{ textDecoration: 'none' }} to={'/admin/Collections'}> - <Button - startIcon={<ListRoundedIcon />} + <StyledButton + icon={<ListRoundedIcon />} variant='outlined' color='primary' - > - Listar - </Button> + text="Listar" + /> </Link> </Grid> </Grid> @@ -256,19 +256,14 @@ const EditCollection = () => { </CardContent> <CardAction> - <Button - onClick={() => { - onSubmit(); - }} + <StyledButton variant="contained" color="primary" disabled={isLoading} - startIcon={isLoading ? null : <SaveIcon />} - > - { - isLoading ? <CircularProgress size={24} /> : 'Salvar' - } - </Button> + icon={isLoading ? null : <SaveIcon />} + onClick={onSubmit} + text={isLoading ? <CircularProgress size={24} /> : 'Salvar'} + /> </CardAction> </StyledCard> ) diff --git a/src/Admin/Components/Components/Inputs/EditLanguage.js b/src/Admin/Components/Components/Inputs/EditLanguage.js index d3d48eefec1f8506f9bdf7137a37d0e09e3ea6ad..f90ad3a637a3e388d4e921a931527d896e747b90 100644 --- a/src/Admin/Components/Components/Inputs/EditLanguage.js +++ b/src/Admin/Components/Components/Inputs/EditLanguage.js @@ -30,6 +30,7 @@ import LoadingSpinner from '../../../../Components/LoadingSpinner'; import { StyledCard } from "../../../Components/Styles/DataCard"; import { Store } from 'Store' import FormInput from "Components/FormInput.js" +import StyledButton from '../Button'; //imports services import { getRequest, putRequest, deleteRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import { EditFilter, GetAData, DeleteFilter } from '../../../Filters'; @@ -239,22 +240,20 @@ const EditLanguage = () => { </Typography> <ButtonGroup> <Link style={{ textDecoration: 'none' }} to={'/admin/languages'}> - <Button - startIcon={<ListRoundedIcon />} + <StyledButton + icon={<ListRoundedIcon />} variant='outlined' color='primary' - > - Listar - </Button> + text="Listar" + /> </Link> - <Button - startIcon={<DeleteRoundedIcon />} + <StyledButton + icon={<DeleteRoundedIcon />} color="secondary" variant="outlined" onClick={DeleteHandler} - > - Deletar - </Button> + text="Deletar" + /> </ButtonGroup> </Grid> @@ -280,19 +279,20 @@ const EditLanguage = () => { </form> </CardContent> <CardAction> - <Button + <StyledButton onClick={() => { onSubmit(); }} variant="contained" color="primary" disabled={isLoading} - startIcon={isLoading ? null : <SaveIcon />} - > - { + icon={isLoading ? null : <SaveIcon />} + text={ isLoading ? <CircularProgress size={24} /> : 'Salvar' } - </Button> + > + + </StyledButton> </CardAction> </StyledCard> ) diff --git a/src/Admin/Components/Components/Inputs/IntitutionsInputs.js b/src/Admin/Components/Components/Inputs/IntitutionsInputs.js index a94c6f70650bafd9223f2cd574c0111cf4abf25d..52bc5cb35f1993ae48275f871a14b3d8150b2f78 100644 --- a/src/Admin/Components/Components/Inputs/IntitutionsInputs.js +++ b/src/Admin/Components/Components/Inputs/IntitutionsInputs.js @@ -30,7 +30,8 @@ import SnackBar from '../../../../Components/SnackbarComponent'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; import { StyledCard } from "../../../Components/Styles/DataCard"; import { Store } from 'Store' -import FormInput from "Components/FormInput.js" +import FormInput from "Components/FormInput.js"; +import StyledButton from '../Button'; //imports services import { putRequest, getRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import { EditFilter, GetAData } from '../../../Filters'; @@ -249,13 +250,12 @@ const EditInstitution = () => { <Grid item> <Link style={{ textDecoration: 'none' }} to={`/admin/institutions`}> - <Button - startIcon={<ListRoundedIcon />} + <StyledButton + icon={<ListRoundedIcon />} color="primary" variant="outlined" - > - Listar - </Button> + text="Listar" + /> </Link> </Grid> </Grid> @@ -282,19 +282,16 @@ const EditInstitution = () => { </form> </div> <div> - <Button + <StyledButton onClick={() => { onSubmit(); }} variant="contained" color="primary" disabled={isLoading} - startIcon={isLoading ? null : <SaveIcon />} - > - { - isLoading ? <CircularProgress size={24} /> : 'Salvar' - } - </Button> + icon={isLoading ? null : <SaveIcon />} + text={isLoading ? <CircularProgress size={24} /> : 'Salvar'} + /> </div> </div> diff --git a/src/Admin/Components/Components/MobileComponents/MobilePageHeader.js b/src/Admin/Components/Components/MobileComponents/MobilePageHeader.js index fdc09e14d505d71d969f5a22a2211592a5347264..56255c2b696ec0a31dbeff1d87a8ff82ca5a9388 100644 --- a/src/Admin/Components/Components/MobileComponents/MobilePageHeader.js +++ b/src/Admin/Components/Components/MobileComponents/MobilePageHeader.js @@ -28,7 +28,7 @@ import { Store } from 'Store' const MobilePageHeader = (props) => { const { state } = useContext(Store); return ( - <Paper style={{marginBottom: "2em", marginTop: "2em", marginLeft: "1em", marginRight: "1em"}}> + <Paper style={{ marginBottom: "2em", marginTop: "2em", marginLeft: "1em", marginRight: "1em" }}> <StyledGrid contrast={state.contrast} container spacing={3} direction="row" alignItems="center"> <Grid item xs={12}> <Typography variant="h4">{props.title}</Typography> @@ -41,7 +41,8 @@ const MobilePageHeader = (props) => { {props.actions.map((act, index) => { return ( <Grid item key={act.name}> - <Button + <StyledButton + contrast={state.contrast} variant="contained" color="secondary" disabled={act.isLoading} @@ -49,7 +50,7 @@ const MobilePageHeader = (props) => { startIcon={act.icon} > {act.isLoading ? <CircularProgress size={24} /> : act.name} - </Button> + </StyledButton> </Grid> ) })} @@ -66,6 +67,18 @@ const StyledGrid = styled(Grid)` color: ${props => props.contrast === "" ? "#666" : "white"}; border: 1px solid ${props => props.contrast === "" ? "#666" : "white"}; border-radius: 10px; + border-radius: 10px; +` + +const StyledButton = styled(Button)` + background-color: ${props => props.contrast === "" ? "" : "black !important"}; + color: ${props => props.contrast === "" ? "" : "yellow !important"}; + border: 1px solid ${props => props.contrast === "" ? "" : "white !important"}; + text-decoration: ${props => props.contrast === "" ? "none !important" : "underline !important"}; + :hover { + background-color: rgba(255,255,0,0.24) !important; + } ` + export default MobilePageHeader; \ No newline at end of file diff --git a/src/Admin/Pages/Pages/SubPages/Collections.js b/src/Admin/Pages/Pages/SubPages/Collections.js index 524ee8828c592f004fde86ea1a02100979310044..bf276295c96fdb1ce8b325c2952b1869308b7282 100644 --- a/src/Admin/Pages/Pages/SubPages/Collections.js +++ b/src/Admin/Pages/Pages/SubPages/Collections.js @@ -28,6 +28,7 @@ import MobileList from "../../../Components/Components/MobileComponents/SimpleLi import MobilePageHeader from "../../../Components/Components/MobileComponents/MobilePageHeader" import PageHeader, { StyledFilter } from "../../../Components/Components/PageHeader" import FormInput from "Components/FormInput.js" +import StyledButton from '../../../Components/Components/Button'; //imports from material ui import { makeStyles } from "@material-ui/core/styles"; import TableBody from "@material-ui/core/TableBody"; @@ -420,17 +421,17 @@ const Collections = () => { { title: "Deletar", subtitle: - <Button + <StyledButton variant="contained" color="secondary" onClick={() => { HandleStateAlertDialog(index); HandleStateCircularProgress(index); }} - startIcon={<DeleteIcon />} + icon={<DeleteIcon />} + text="Deletar" > - Deletar - </Button> + </StyledButton> } ] } diff --git a/src/Admin/Pages/Pages/SubPages/Institutions.js b/src/Admin/Pages/Pages/SubPages/Institutions.js index b578806dee426cc4375f31570fa3552a7bdd68b5..78984734f3733d84b9081dfd19146227a8828879 100644 --- a/src/Admin/Pages/Pages/SubPages/Institutions.js +++ b/src/Admin/Pages/Pages/SubPages/Institutions.js @@ -26,7 +26,8 @@ import MobileList from "../../../Components/Components/MobileComponents/SimpleLi import MobilePageHeader from "../../../Components/Components/MobileComponents/MobilePageHeader" import PageHeader, { StyledFilter } from "../../../Components/Components/PageHeader" import { StyledLoadMoreButton, StyledDivButton, useStylesCell, useStylesRow } from "./Collections.js"; -import { Store } from 'Store' +import { Store } from 'Store'; +import StyledButton from '../../../Components/Components/Button'; // Imports about icon import FilterListRoundedIcon from "@material-ui/icons/FilterListRounded"; import AddRoundedIcon from "@material-ui/icons/AddRounded"; @@ -52,10 +53,10 @@ import AccountBalanceRoundedIcon from "@material-ui/icons/AccountBalanceRounded" const Institutions = () => { - const { state } = useContext(Store) + const { state } = useContext(Store) - const classesCell = useStylesCell(state); - const classesRow = useStylesRow(state); + const classesCell = useStylesCell(state); + const classesRow = useStylesRow(state); const WINDOW_WIDTH = window.innerWidth const ADD_ONE_LENGHT = [""]; @@ -338,23 +339,23 @@ const Institutions = () => { { showFilter && <StyledFilter contrast={state.contrast}> - <Grid item xs={12}> - <Grid container justify="space-between" spacing={3}> - {TextFieldOfTheFilter.map((field, index) => ( - <Grid item key={field.label}> + <Grid item xs={12}> + <Grid container justify="space-between" spacing={3}> + {TextFieldOfTheFilter.map((field, index) => ( + <Grid item key={field.label}> <FormInput - contrast={state.contrast} - id={index} - placeholder={field.label} - handleChange={field.onChange} - onBlur={field.onBlur} - value={field.value} - help={field.helperText} + contrast={state.contrast} + id={index} + placeholder={field.label} + handleChange={field.onChange} + onBlur={field.onBlur} + value={field.value} + help={field.helperText} /> - </Grid> - ))} + </Grid> + ))} + </Grid> </Grid> - </Grid> </StyledFilter> } </MobilePageHeader> @@ -368,7 +369,7 @@ const Institutions = () => { key={new Date().toISOString() + row.created_at} > <StyledLoadMoreButton - contrast={state.contrast} + contrast={state.contrast} color="primary" variant="text" // disabled={isLoadingMoreItems} @@ -381,59 +382,58 @@ const Institutions = () => { {isLoadingMoreItems ? ( <CircularProgress size={24} /> ) : ( - "Carregar mais itens" - )} + "Carregar mais itens" + )} </StyledLoadMoreButton> </StyledDivButton> ) : ( - <> - <MobileList - contrast={state.contrast} - key={new Date().toISOString() + row.created_at} - title={row.name} - subtitle={row.id} - backColor={"#ff7f00"} - avatar={<AccountBalanceRoundedIcon />} - href={`/admin/institution?institution=${row.id}`} - reset={() => { - - }} - data={ - [ - { - title: "Descrição", - subtitle: row.description ? row.description : "Sem dado" - - }, - { - title: "Cidade", - subtitle: row.city ? row.city : "Sem dado" - - }, - { - title: "País", - subtitle: row.country ? row.country : "Sem dado" - }, - { - title: "Deletar", - subtitle: - <Button - variant="contained" - color="secondary" - onClick={() => { - HandleStateAlertDialog(index); - HandleStateCircularProgress(index); - }} - startIcon={<DeleteIcon />} - > - Deletar - </Button> - } - ] - } - /> - </> - ) + <> + <MobileList + contrast={state.contrast} + key={new Date().toISOString() + row.created_at} + title={row.name} + subtitle={row.id} + backColor={"#ff7f00"} + avatar={<AccountBalanceRoundedIcon />} + href={`/admin/institution?institution=${row.id}`} + reset={() => { + + }} + data={ + [ + { + title: "Descrição", + subtitle: row.description ? row.description : "Sem dado" + + }, + { + title: "Cidade", + subtitle: row.city ? row.city : "Sem dado" + + }, + { + title: "País", + subtitle: row.country ? row.country : "Sem dado" + }, + { + title: "Deletar", + subtitle: + <StyledButton + variant="contained" + color="secondary" + onClick={() => { + HandleStateAlertDialog(index); + HandleStateCircularProgress(index); + }} + icon={<DeleteIcon />} + text="Deletar" + /> + } + ] + } + /> + </> + ) )} {/************** End of display data in table **************/} @@ -491,23 +491,23 @@ const Institutions = () => { { showFilter && <StyledFilter contrast={state.contrast}> - <Grid item xs={12}> - <Grid container justify="space-between" spacing={3}> - {TextFieldOfTheFilter.map((field, index) => ( - <Grid item key={field.label}> + <Grid item xs={12}> + <Grid container justify="space-between" spacing={3}> + {TextFieldOfTheFilter.map((field, index) => ( + <Grid item key={field.label}> <FormInput - contrast={state.contrast} - id={index} - placeholder={field.label} - handleChange={field.onChange} - onBlur={field.onBlur} - value={field.value} - help={field.helperText} + contrast={state.contrast} + id={index} + placeholder={field.label} + handleChange={field.onChange} + onBlur={field.onBlur} + value={field.value} + help={field.helperText} /> - </Grid> - ))} + </Grid> + ))} + </Grid> </Grid> - </Grid> </StyledFilter> } </PageHeader> @@ -529,52 +529,52 @@ const Institutions = () => { onClick={() => { setCurrPage(currPage + 1) }} - style={state.contrast === "" ? {width: "100%"} : {width: "100%", color: "yellow", textDecoration: "underline yellow"}} + style={state.contrast === "" ? { width: "100%" } : { width: "100%", color: "yellow", textDecoration: "underline yellow" }} > {isLoadingMoreItems ? ( <CircularProgress size={24} /> ) : ( - "Carregar mais itens" - )} + "Carregar mais itens" + )} </Button> </TableCell> </TableRow> ) : ( - <TableRow className={classesRow.root} key={new Date().toISOString() + index}> - <TableCell className={classesCell.root} component="th" scope="row"> - {row.id} - </TableCell> - <TableCell className={classesCell.root} align="right">{row.name}</TableCell> - <TableCell className={classesCell.root} align="right"> - {row.description} - </TableCell> - <TableCell className={classesCell.root} align="right">{row.city}</TableCell> - <TableCell className={classesCell.root} align="right"> - {row.country} - </TableCell> - <TableCell className={classesCell.root} align="right"> - <Link to={`/admin/institution?institution=${row.id}`}> - <IconButton> - <VisibilityIcon style={{ fill: state.contrast === "" ? "#00bcd4" : "yellow" }} /> - </IconButton> - </Link> - </TableCell> - <TableCell className={classesCell.root} align="right"> - {isLoadingToDelete === index ? ( - <CircularProgress size={24} color="primary" /> - ) : ( - <IconButton - onClick={() => { - HandleStateAlertDialog(index); - HandleStateCircularProgress(index); - }} - > - <DeleteIcon style={{ fill: state.contrast === "" ? "#FF0000" : "yellow" }} /> - </IconButton> - )} - </TableCell> - </TableRow> - ) + <TableRow className={classesRow.root} key={new Date().toISOString() + index}> + <TableCell className={classesCell.root} component="th" scope="row"> + {row.id} + </TableCell> + <TableCell className={classesCell.root} align="right">{row.name}</TableCell> + <TableCell className={classesCell.root} align="right"> + {row.description} + </TableCell> + <TableCell className={classesCell.root} align="right">{row.city}</TableCell> + <TableCell className={classesCell.root} align="right"> + {row.country} + </TableCell> + <TableCell className={classesCell.root} align="right"> + <Link to={`/admin/institution?institution=${row.id}`}> + <IconButton> + <VisibilityIcon style={{ fill: state.contrast === "" ? "#00bcd4" : "yellow" }} /> + </IconButton> + </Link> + </TableCell> + <TableCell className={classesCell.root} align="right"> + {isLoadingToDelete === index ? ( + <CircularProgress size={24} color="primary" /> + ) : ( + <IconButton + onClick={() => { + HandleStateAlertDialog(index); + HandleStateCircularProgress(index); + }} + > + <DeleteIcon style={{ fill: state.contrast === "" ? "#FF0000" : "yellow" }} /> + </IconButton> + )} + </TableCell> + </TableRow> + ) )} </TableBody> </TableData> diff --git a/src/Admin/Pages/Pages/SubPages/Languages.js b/src/Admin/Pages/Pages/SubPages/Languages.js index a82e0d0d5de1280740cb8bd0d63bdb11340ab906..021926409dd8e89bcbf2065ba4074e3adfa2a642 100644 --- a/src/Admin/Pages/Pages/SubPages/Languages.js +++ b/src/Admin/Pages/Pages/SubPages/Languages.js @@ -30,6 +30,7 @@ import MobilePageHeader from "../../../Components/Components/MobileComponents/Mo import PageHeader from "../../../Components/Components/PageHeader" import { Store } from 'Store' import { StyledLoadMoreButton, StyledDivButton, useStylesCell, useStylesRow } from './Collections'; +import StyledButton from '../../../Components/Components/Button'; //imports from material ui import TableBody from '@material-ui/core/TableBody'; import TableCell from '@material-ui/core/TableCell'; @@ -47,10 +48,10 @@ import LanguageRoundedIcon from "@material-ui/icons/LanguageRounded"; const Languages = () => { - const { state } = useContext(Store) + const { state } = useContext(Store) - const classesCell = useStylesCell(state); - const classesRow = useStylesRow(state); + const classesCell = useStylesCell(state); + const classesRow = useStylesRow(state); const ADD_ONE_LENGHT = [""]; const TOP_LABELS = ['ID', 'NOME', 'CODE', 'EDITAR', 'DELETAR'] //Labels from Table @@ -238,7 +239,7 @@ const Languages = () => { index === items.length - 1 ? ( <StyledDivButton contrast={state.contrast} key={new Date().toISOString() + row.created_at}> <StyledLoadMoreButton - contrast={state.contrast} + contrast={state.contrast} color="primary" variant="text" // disabled={isLoadingMoreItems} @@ -251,49 +252,48 @@ const Languages = () => { {isLoadingMoreItems ? ( <CircularProgress size={24} /> ) : ( - "Carregar mais itens" - )} + "Carregar mais itens" + )} </StyledLoadMoreButton> </StyledDivButton> ) : ( - <> - <MobileList - contrast={state.contrast} - key={new Date().toISOString() + row.created_at} - title={row.name} - subtitle={row.id} - backColor={"#e81f4f"} - avatar={<LanguageRoundedIcon />} - href={`/admin/languageEdit?language=${row.id}`} - reset={() => { + <> + <MobileList + contrast={state.contrast} + key={new Date().toISOString() + row.created_at} + title={row.name} + subtitle={row.id} + backColor={"#e81f4f"} + avatar={<LanguageRoundedIcon />} + href={`/admin/languageEdit?language=${row.id}`} + reset={() => { - }} - data={ - [ - { - title: "Code", - subtitle: row.code - }, - { - title: "Deletar", - subtitle: - <Button - variant="contained" - color="secondary" - onClick={() => { - HandleStateAlertDialog(index); - HandleStateCircularProgress(index); - }} - startIcon={<DeleteRoundedIcon />} - > - Deletar - </Button> - } - ] - } - /> - </> - ) + }} + data={ + [ + { + title: "Code", + subtitle: row.code + }, + { + title: "Deletar", + subtitle: + <StyledButton + variant="contained" + color="secondary" + onClick={() => { + HandleStateAlertDialog(index); + HandleStateCircularProgress(index); + }} + icon={<DeleteRoundedIcon />} + text="Deletar" + /> + } + ] + } + /> + </> + ) )} </> ); @@ -356,7 +356,7 @@ const Languages = () => { onClick={() => { setCurrPage(currPage + 1) }} - style={state.contrast === "" ? {width: "100%"} : {width: "100%", color: "yellow", textDecoration: "underline yellow"}} + style={state.contrast === "" ? { width: "100%" } : { width: "100%", color: "yellow", textDecoration: "underline yellow" }} > { isLoadingMoreItems ? <CircularProgress size={24} /> : 'Carregar mais itens' @@ -382,15 +382,15 @@ const Languages = () => { {isLoadingToDelete === index ? ( <CircularProgress size={24} color="primary" /> ) : ( - <IconButton - onClick={() => { - HandleStateAlertDialog(index); - HandleStateCircularProgress(index); - }} - > - <DeleteRoundedIcon style={{ fill: state.contrast === "" ? "#FF0000" : "yellow" }} /> - </IconButton> - )} + <IconButton + onClick={() => { + HandleStateAlertDialog(index); + HandleStateCircularProgress(index); + }} + > + <DeleteRoundedIcon style={{ fill: state.contrast === "" ? "#FF0000" : "yellow" }} /> + </IconButton> + )} </TableCell> </TableRow> ))}