Skip to content

Commit

Permalink
Incluindo props nos componentes
Browse files Browse the repository at this point in the history
  • Loading branch information
Andresavieira28 committed Mar 21, 2023
1 parent 3719084 commit 5caac7a
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Banner from './componentes/Banner/banner';
import Form from './componentes/form/form'

function App() {
return (
<div className="App">
Expand Down
22 changes: 22 additions & 0 deletions src/componentes/ListaSuspensa/ListaSuspensa.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.lista-suspensa select {
background-color: #FFF;
box-shadow: 10px 10px 30px rgba(0, 0, 0.06);
width: 100%;
border: none;
font-size: 24px;
padding: 24px;
border-radius: 10px;
}

.lista-suspensa {
display: block;
margin-bottom: 8px;
font-size: 24px;
}

.lista-suspensa label {
display: block;
margin-bottom: 8px;
font-size: 20px;
font-weight: bold
}
17 changes: 17 additions & 0 deletions src/componentes/ListaSuspensa/ListaSuspensa.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import "./ListaSuspensa.css"


const ListaSuspensa = (props) => {
return (
<div className="lista-suspensa">
<label>{props.label}</label>
<select required={props.required}>
{props.itens.map((item) => {
return <option key={item}>{item}</option>;
})}
</select>
</div>
);
};

export default ListaSuspensa;
6 changes: 3 additions & 3 deletions src/componentes/TextField/TextField.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
}
.text-field input {
background-color: #FFF;
box-shadow: 10px 10px 30px rgba(0, 0, 0, 0.06);
width: 50%;
box-shadow: 10px 10px 30px rgba(0, 0, 0.06);
width: 100%;
border: none;
font-size: 24px;
padding: 24px;
box-sizing: border-box;
border-radius: 10px;
}
2 changes: 1 addition & 1 deletion src/componentes/TextField/TextField.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const TextField = (props) => {
<label>
{props.label}
</label>
<input placeholder={`${props.placeholder}...`}/>
<input required={props.obrigatorio} placeholder={`${props.placeholder}...`}/>
</div>
)
}
Expand Down
15 changes: 15 additions & 0 deletions src/componentes/botao/botao.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.botao {
background-color: #6278f7;
border-radius: 10px;
font-weight: 700;
font-size: 18px;
padding: 32px;
border: none;
cursor: pointer;
color: #FFF;
margin: 16px 0;
}

.botao:hover {
color: #95FFD4
}
9 changes: 9 additions & 0 deletions src/componentes/botao/botao.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import "./botao.css"

const Botao = (props) => {
return (<button className='botao'>
{props.children}
</button>)
}

export default Botao
4 changes: 2 additions & 2 deletions src/componentes/form/form.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.formulario {
display: flex;
justify-content: center;
margin: 80 px 0;
margin: 80px 0;
}
.formulario form {
max-width: 80%;
background-color: #F2F2F2;
border-radius: 20px;
padding: 36px 64px;
box-shadow: 8px 8px 16px rgba(0, 0, 0, 0.08);
box-shadow: 8px 8px 16px rgba(0, 0 ,0, 0.08);
}
25 changes: 22 additions & 3 deletions src/componentes/form/form.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
import ListaSuspensa from "../ListaSuspensa/ListaSuspensa";
import TextField from "../TextField/TextField";
import Botao from "../botao/botao"
import "./form.css";

const Formulario = () => {
const times = [
'Programação',
'Front-End',
'Data Science',
'Devops',
'UX e Design',
'Mobile',
'Inovação e Gestão'
]

const save = (e) => {
e.preventDefault()
console.log('o form foi submetido!')
}

return (
<section className="formulario">
<form>
<form onSubmit={save}>
<h2>Preencha os dados para criar o card do colaborador</h2>
<TextField label="Nome" placeholder="Digite o seu nome" />
<TextField label="Cargo" placeholder="Digite o seu cargo" />
<TextField obrigatorio={true} label="Nome" placeholder="Digite o seu nome" />
<TextField obrigatorio={true} label="Cargo" placeholder="Digite o seu cargo" />
<TextField label="Imagem" placeholder="Digite o endereço da sua imagem"/>
<ListaSuspensa obrigatorio={true} label="Time" itens={times}/>
<Botao children="Criar Card"/>
</form>
</section>
);
Expand Down

0 comments on commit 5caac7a

Please sign in to comment.