-
Notifications
You must be signed in to change notification settings - Fork 0
PR de correção! Não precisa mergeear! #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: correcao-projeto
Are you sure you want to change the base?
Changes from all commits
cbbb633
6eea9f7
6f74a5d
a0d5a42
108907a
1dfa9b7
bb6578e
34f50fc
f3730fa
03df500
c381e82
938dd7e
94134b2
f61619d
6828ed9
d00ae29
5a5fdd4
8969a4d
e7a74db
e29a2eb
b2f384d
96d0ace
7713556
7addc0b
5dd4282
5b5064e
2ceb1e9
23cb3d7
676ba0a
879c875
8c6d718
707ef43
6c6fe9e
a3c5c9d
5370a83
ac4a33e
a27d5ea
7e92687
356bc47
2980a96
2204164
604ba69
d8ab37a
7f944c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,65 @@ | ||
| import React, { Component } from 'react' | ||
| import Home from './Home' | ||
| import Header from './Header' | ||
| import CriacaoDeServicos from './CriacaoDeServicos' | ||
| import Servicos from './servicos/Servicos' | ||
| import Footer from './Footer' | ||
| import styled from 'styled-components' | ||
|
|
||
| const ContainerRenderiza = styled.div` | ||
| position:relative; | ||
| margin-bottom: 80px; | ||
| ` | ||
|
|
||
| export class AppContainer extends Component { | ||
|
|
||
| state = { | ||
| paginaSelecionada: "home" | ||
| } | ||
|
|
||
| onClickVoltar = () => { | ||
| this.setState({paginaSelecionada: "home"}) | ||
| } | ||
|
|
||
| onClickCriarServico = () => { | ||
| this.setState({paginaSelecionada: "criacaodeservicos"}) | ||
| } | ||
|
|
||
| onClickServicos = () => { | ||
| this.setState({paginaSelecionada: "servicos"}) | ||
| } | ||
|
|
||
| render() { | ||
|
|
||
| const renderizaNaTela = () => { | ||
|
|
||
| switch (this.state.paginaSelecionada) { | ||
| case "home": | ||
| return <Home | ||
| abrirServico={this.onClickServicos} | ||
| abrirCriacaoDeServicos={this.onClickCriarServico} | ||
| /> | ||
| case "servicos": | ||
| return <Servicos | ||
| voltar={this.onClickVoltar} | ||
| /> | ||
| case "criacaodeservicos": | ||
| return <CriacaoDeServicos | ||
| voltar={this.onClickVoltar} | ||
| /> | ||
| } | ||
| } | ||
|
|
||
| return ( | ||
| <div> | ||
|
|
||
| <Header | ||
| onClickCriarServico={this.onClickCriarServico} | ||
| onClickServicos={this.onClickServicos} | ||
| onClickHome={this.onClickVoltar}/> | ||
|
Comment on lines
+55
to
+58
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Atenção pra identação. Coloquem margem nas props e quebrem linha para fechar a tag: |
||
| <ContainerRenderiza>{renderizaNaTela()}</ContainerRenderiza> | ||
| <Footer /> | ||
| </div> | ||
| ) | ||
|
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,184 @@ | ||
| import React from 'react' | ||
| import styled from 'styled-components' | ||
| import axios from 'axios' | ||
| import CheckBox from '@material-ui/core/Checkbox' | ||
| import TextField from '@material-ui/core/TextField' | ||
| import FormGroup from '@material-ui/core/FormGroup' | ||
| import FormControlLabel from '@material-ui/core/FormControlLabel' | ||
| import FormLabel from '@material-ui/core/FormLabel' | ||
| import FormControl from '@material-ui/core/FormControl' | ||
|
|
||
|
|
||
| const ContainerInputs = styled.div` | ||
| display: flex; | ||
| justify-content: center; | ||
| width: 50vw; | ||
| margin: 8px auto; | ||
| ` | ||
| const ContainerButtons = styled.div` | ||
| width: 10vw; | ||
| display: flex; | ||
| justify-content:space-between; | ||
| margin: 0 auto; | ||
| ` | ||
| const StyledTextField = styled(TextField)` | ||
| width: 30vw; | ||
| ` | ||
| const ContainerServicos = styled.div` | ||
| border: 1px solid black; | ||
| width: 50vw; | ||
| padding: 16px; | ||
| margin: 16px auto; | ||
| border-radius: 20px; | ||
|
Comment on lines
+12
to
+32
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Na próxima, tentem isolar as constantes do styled-components em um arquivo separado e apenas as importem no componente. Isso deixa o código bem mais limpo. Se vcs tiverem dúvida sobre isso, mandem lá no canal de dúvidas que podemos ajudar vcs... |
||
| ` | ||
| export const ButtonCriacao = styled.button` | ||
| margin: 16px; | ||
| height: 40px; | ||
| width: 200px; | ||
| background-color: black; | ||
| color: #FFF; | ||
| border: none; | ||
| border-radius: 10px; | ||
| cursor: pointer; | ||
| outline:none; | ||
| :hover{ | ||
| background-color: #FFEA52; | ||
| color: #474117; | ||
| } | ||
| ` | ||
| class CriacaoDeServicos extends React.Component { | ||
|
|
||
| state = { | ||
| inputTitulo: "", | ||
| inputDescricao: "", | ||
| inputValorDaRemuneracao: "", | ||
| inputPrazo: "", | ||
| metodosPag: [] | ||
| } | ||
|
|
||
| onChangeInputTitulo = (event) => { | ||
| this.setState({inputTitulo: event.target.value}) | ||
| } | ||
|
|
||
| onChangeInputDescricao = (event) => { | ||
| this.setState({inputDescricao: event.target.value}) | ||
| } | ||
|
|
||
| onChangeInputValorDaRemuneracao = (event) => { | ||
| this.setState({inputValorDaRemuneracao: event.target.value}) | ||
| } | ||
|
|
||
| onChangeInputPrazo = (event) => { | ||
| this.setState({inputPrazo: event.target.value}) | ||
| } | ||
|
|
||
| onChangeChecked = (event) => { | ||
| let metodosPag = [...this.state.metodosPag, event.target.id] | ||
| if(this.state.metodosPag.includes(event.target.id)){ | ||
| metodosPag = metodosPag.filter(metodo => metodo !== event.target.id) | ||
| } | ||
| this.setState({ | ||
| metodosPag: metodosPag | ||
| }) | ||
|
|
||
| } | ||
|
|
||
| cadastroServico = () => { | ||
| const body = { | ||
| "title": this.state.inputTitulo, | ||
| "description": this.state.inputDescricao, | ||
| "value": this.state.inputValorDaRemuneracao, | ||
| "paymentMethods": this.state.metodosPag, | ||
| "dueDate": this.state.inputPrazo | ||
| } | ||
| axios.post('https://us-central1-labenu-apis.cloudfunctions.net/futureNinjasOne/jobs', body).then( | ||
| alert("Serviço cadastrado com sucesso!"), | ||
| this.setState({inputTitulo: "", inputDescricao: "", inputValorDaRemuneracao: "", inputPrazo: "", metodosPag: []}) | ||
| ).catch(err => { | ||
| console.log(err) | ||
| }) | ||
| } | ||
|
|
||
| render () { | ||
| console.log(this.state.metodosPag) | ||
| return ( | ||
| <ContainerServicos> | ||
| <ContainerInputs> | ||
| <StyledTextField | ||
| required | ||
| label='Título' | ||
| onChange={this.onChangeInputTitulo} | ||
| value={this.state.inputTitulo} | ||
| /> | ||
| </ContainerInputs> | ||
| <ContainerInputs> | ||
| <StyledTextField | ||
| required | ||
| label='Descrição' | ||
| onChange={this.onChangeInputDescricao} | ||
| value={this.state.inputDescricao} | ||
| /> | ||
| </ContainerInputs> | ||
| <ContainerInputs> | ||
| <StyledTextField | ||
| required | ||
| label='Valor da Remuneração' | ||
| onChange={this.onChangeInputValorDaRemuneracao} | ||
| value={this.state.inputValorDaRemuneracao} | ||
| /> | ||
| </ContainerInputs> | ||
| <ContainerInputs> | ||
| <StyledTextField | ||
| required | ||
| label='Prazo' | ||
| onChange={this.onChangeInputPrazo} | ||
| value={this.state.inputPrazo} | ||
| /> | ||
| </ContainerInputs> | ||
| <ContainerInputs> | ||
| <FormControl> | ||
| <FormLabel component="legend">Formas de Pagamento</FormLabel> | ||
| <FormGroup> | ||
| <FormControlLabel | ||
| control={ | ||
| <CheckBox color="primary" type="checkbox" id="Transferência Bancária" value="Transferência Bancária" onChange={this.onChangeChecked}/> | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Atenção com a identação. Muitas props pedem quebra de linhas... |
||
| } | ||
| label="Transferência Bancária" | ||
| /> | ||
| <FormControlLabel | ||
| control={ | ||
| <CheckBox color="primary" type="checkbox" id="Cartão de débito" value="Cartão de débito" onChange={this.onChangeChecked}/> | ||
| } | ||
| label="Cartão de débito" | ||
| /> | ||
| <FormControlLabel | ||
| control={ | ||
| <CheckBox color="primary" type="checkbox" id="Cartão de crédito" value="Cartão de crédito" onChange={this.onChangeChecked}/> | ||
| } | ||
| label="Cartão de Crédito" | ||
| /> | ||
| <FormControlLabel | ||
| control={ | ||
| <CheckBox color="primary" type="checkbox" id="Dinheiro" value="Dinheiro" onChange={this.onChangeChecked}/> | ||
| } | ||
| label="Dinheiro" | ||
| /> | ||
| <FormControlLabel | ||
| control={ | ||
| <CheckBox color="primary" type="checkbox" id="Boleto" value="Boleto" onChange={this.onChangeChecked}/> | ||
| } | ||
| label="Cartão de Crédito" | ||
| /> | ||
| </FormGroup> | ||
| </FormControl> | ||
| </ContainerInputs> | ||
| <ContainerButtons> | ||
| <ButtonCriacao onClick={this.cadastroServico}>Cadastrar</ButtonCriacao> | ||
| <ButtonCriacao onClick={this.props.voltar}>Voltar</ButtonCriacao> | ||
| </ContainerButtons> | ||
| </ContainerServicos> | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| export default CriacaoDeServicos | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apesar dos meus comentários sobre identação, o código está muito bem escrito e identado! Parabéns! |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import React from 'react' | ||
| import styled from 'styled-components' | ||
|
|
||
| const ContainerFooter = styled.div` | ||
| height: 50px; | ||
| position: fixed; | ||
| bottom: 0; | ||
| background-color: #2B2D2F; | ||
| color: #FFF; | ||
| width: 100vw; | ||
| text-align: center; | ||
| font-size: 0.7em; | ||
| ` | ||
|
|
||
| class Footer extends React.Component { | ||
| render () { | ||
| return ( | ||
| <ContainerFooter> | ||
| <h2>Designed and created by Future Ninjas</h2> | ||
| </ContainerFooter> | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| export default Footer |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import React from 'react' | ||
| import styled from 'styled-components' | ||
| import Button from '@material-ui/core/Button' | ||
|
|
||
| const H1Header = styled.h1` | ||
| margin: 0; | ||
| padding: 0; | ||
| font-family: Andale Mono, monospace; | ||
| cursor: pointer; | ||
| ` | ||
|
Comment on lines
+5
to
+10
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Atenção para nomeação das constantes do styled-components. H1 não é um bom nome. |
||
|
|
||
| const ContainerHeader = styled.div` | ||
| height: 10vh; | ||
| display: flex; | ||
| justify-content: space-between; | ||
| border-bottom: 1px solid grey; | ||
| padding: 8px; | ||
| align-items: center; | ||
| padding: 0 32px; | ||
| ` | ||
|
|
||
| export const ButtonHeader = styled.button` | ||
| margin: 16px; | ||
| height: 40px; | ||
| width: 200px; | ||
| background-color: black; | ||
| color: #FFF; | ||
| border: none; | ||
| border-radius: 10px; | ||
| cursor: pointer; | ||
| outline:none; | ||
| :hover{ | ||
| background-color: #FFEA52; | ||
| color: #474117; | ||
| } | ||
| ` | ||
|
|
||
| class Servicos extends React.Component { | ||
| render () { | ||
| return ( | ||
| <ContainerHeader> | ||
| <H1Header onClick={this.props.onClickHome}>Future Ninjas</H1Header> | ||
| <div> | ||
| <ButtonHeader onClick={this.props.onClickServicos}>PROCURE SERVIÇOS!</ButtonHeader> | ||
| <ButtonHeader onClick={this.props.onClickCriarServico}>SEJA UM PROFISSIONAL!</ButtonHeader> | ||
| </div> | ||
|
|
||
| </ContainerHeader> | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| export default Servicos | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bom uso da renderização condicional! 👏👏