diff --git a/src/components/fieldsAnswerForm/FormFieldTitle.js b/src/components/fieldsAnswerForm/FormFieldTitle.js index cf2c22ec568ce0ba84b83f1530666eba44ab43b2..9a41a54b6fe02c6490bae0f992a4ed8f2ccd6371 100644 --- a/src/components/fieldsAnswerForm/FormFieldTitle.js +++ b/src/components/fieldsAnswerForm/FormFieldTitle.js @@ -10,7 +10,7 @@ const useStyles = makeStyles(theme => ({ paper: { padding: theme.spacing(3), width: theme.spacing(100), - height: theme.spacing(22), + height: "40%", margin: theme.spacing(2), color: "#000000", ["@media (max-width:827px)"]: { @@ -38,10 +38,10 @@ const useStyles = makeStyles(theme => ({ } }, description: { - fontSize: "30px", + fontSize: "25px", color: "#000000", ["@media (max-width:827px)"]: { - fontSize: "25px" + fontSize: "20px" }, ["@media (max-width:590px)"]: { fontSize: "15px" @@ -53,40 +53,38 @@ function FormFieldText(props) { const classes = useStyles(); return ( - <Grid> - <Paper className={classes.paper}> - <Grid container> - <Grid item xs={12} className={classes.questionsGrid}> - <Typography - style={{ wordWrap: "break-word" }} - className={classes.title} - variant="h3" - gutterBottom - > - {props.title} - </Typography> - </Grid> - <Grid item xs={9} className={classes.questionsGrid}> - <Typography - style={{ wordWrap: "break-word" }} - className={classes.description} - variant="h4" - gutterBottom - > - {props.description} - </Typography> - </Grid> - <Grid - item - container - direction="row" - justify="flex-end" - alignItems="flex-end" - xs={3} - ></Grid> + <Paper className={classes.paper}> + <Grid container> + <Grid item xs={12} className={classes.questionsGrid}> + <Typography + style={{ wordWrap: "break-word" }} + className={classes.title} + variant="h3" + gutterBottom + > + {props.title} + </Typography> + </Grid> + <Grid item xs={12} className={classes.questionsGrid}> + <Typography + style={{ wordWrap: "break-word" }} + className={classes.description} + variant="h6" + gutterBottom + > + {props.description} + </Typography> </Grid> - </Paper> - </Grid> + <Grid + item + container + direction="row" + justify="flex-end" + alignItems="flex-end" + xs={3} + ></Grid> + </Grid> + </Paper> ); } diff --git a/src/pages/AnswerForm.js b/src/pages/AnswerForm.js index f09d9e0408172c1165939dd0c713e9eda44f5556..47fc79143e39e76841bba393be7ab22d87bea88e 100644 --- a/src/pages/AnswerForm.js +++ b/src/pages/AnswerForm.js @@ -164,6 +164,10 @@ function AnwserForm() { .post(`/answer/${id}`, backendTranslation()) .then(function(res) { alert("Formulário respondido!"); + }) + .catch(error => { + alert("Ocorreu um erro ao responder seu formulário."); + return; }); } @@ -200,10 +204,22 @@ function AnwserForm() { * @param id - Form id got from the broswer's URL */ async function getForm(id) { - const res = await api.get(`/form/${id}`).then(function(res) { - setFormData(res.data); - mapInputs(res.data); - }); + const res = await api + .get(`/form/${id}`) + .then(function(res) { + setFormData(res.data); + mapInputs(res.data); + }) + .catch(error => { + if (error.response.status === 401) { + alert("Você não está logado."); + return; + } + if (error.response.status === 500) { + alert("Ocorreu um erro: formulário não encontrado."); + return; + } + }); } /** First thing the page does is getting the form from the API. */