Skip to content

Commit d52b937

Browse files
committedMar 7, 2023
feat: create Formulario and Formulario.test
0 parents  commit d52b937

28 files changed

+24614
-0
lines changed
 

‎.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*

‎README.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Getting Started with Create React App
2+
3+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4+
5+
## Available Scripts
6+
7+
In the project directory, you can run:
8+
9+
### `npm start`
10+
11+
Runs the app in the development mode.\
12+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13+
14+
The page will reload if you make edits.\
15+
You will also see any lint errors in the console.
16+
17+
### `npm test`
18+
19+
Launches the test runner in the interactive watch mode.\
20+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21+
22+
### `npm run build`
23+
24+
Builds the app for production to the `build` folder.\
25+
It correctly bundles React in production mode and optimizes the build for the best performance.
26+
27+
The build is minified and the filenames include the hashes.\
28+
Your app is ready to be deployed!
29+
30+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31+
32+
### `npm run eject`
33+
34+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
35+
36+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37+
38+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
39+
40+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
41+
42+
## Learn More
43+
44+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45+
46+
To learn React, check out the [React documentation](https://reactjs.org/).

‎package-lock.json

+24,248
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"name": "sorteador",
3+
"version": "0.1.0",
4+
"private": true,
5+
"dependencies": {
6+
"@testing-library/jest-dom": "^5.16.2",
7+
"@testing-library/react": "^12.1.4",
8+
"@testing-library/user-event": "^13.5.0",
9+
"@types/jest": "^27.4.1",
10+
"@types/node": "^16.11.26",
11+
"@types/react": "^17.0.41",
12+
"@types/react-dom": "^17.0.14",
13+
"just-shuffle": "^4.0.1",
14+
"react": "^17.0.2",
15+
"react-dom": "^17.0.2",
16+
"react-router-dom": "^6.2.2",
17+
"react-scripts": "5.0.0",
18+
"recoil": "^0.6.1",
19+
"typescript": "^4.6.2",
20+
"web-vitals": "^2.1.4"
21+
},
22+
"scripts": {
23+
"start": "react-scripts start",
24+
"build": "react-scripts build",
25+
"test": "react-scripts test",
26+
"eject": "react-scripts eject"
27+
},
28+
"eslintConfig": {
29+
"extends": [
30+
"react-app",
31+
"react-app/jest"
32+
]
33+
},
34+
"browserslist": {
35+
"production": [
36+
">0.2%",
37+
"not dead",
38+
"not op_mini all"
39+
],
40+
"development": [
41+
"last 1 chrome version",
42+
"last 1 firefox version",
43+
"last 1 safari version"
44+
]
45+
}
46+
}

‎public/favicon.ico

3.78 KB
Binary file not shown.

‎public/imagens/aviao.png

9.06 KB
Loading

‎public/imagens/logo-pequeno.png

13.6 KB
Loading

‎public/imagens/logo.png

7.12 KB
Loading

‎public/imagens/participante.png

31.2 KB
Loading

‎public/imagens/sacolas.png

13.4 KB
Loading

‎public/index.html

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<meta
9+
name="description"
10+
content="Web site created using create-react-app"
11+
/>
12+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
14+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
15+
16+
<link rel="preconnect" href="https://fonts.googleapis.com">
17+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
18+
<link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
19+
rel="stylesheet">
20+
<title>Sorteador de Amigo Secreto</title>
21+
</head>
22+
<body>
23+
<noscript>You need to enable JavaScript to run this app.</noscript>
24+
<div id="root"></div>
25+
</body>
26+
</html>

‎public/logo192.png

5.22 KB
Loading

‎public/logo512.png

9.44 KB
Loading

‎public/manifest.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"short_name": "React App",
3+
"name": "Create React App Sample",
4+
"icons": [
5+
{
6+
"src": "favicon.ico",
7+
"sizes": "64x64 32x32 24x24 16x16",
8+
"type": "image/x-icon"
9+
},
10+
{
11+
"src": "logo192.png",
12+
"type": "image/png",
13+
"sizes": "192x192"
14+
},
15+
{
16+
"src": "logo512.png",
17+
"type": "image/png",
18+
"sizes": "512x512"
19+
}
20+
],
21+
"start_url": ".",
22+
"display": "standalone",
23+
"theme_color": "#000000",
24+
"background_color": "#ffffff"
25+
}

‎public/robots.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# https://www.robotstxt.org/robotstxt.html
2+
User-agent: *
3+
Disallow:

‎src/App.css

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
.App {
2+
text-align: center;
3+
}
4+
5+
.App-logo {
6+
height: 40vmin;
7+
pointer-events: none;
8+
}
9+
10+
@media (prefers-reduced-motion: no-preference) {
11+
.App-logo {
12+
animation: App-logo-spin infinite 20s linear;
13+
}
14+
}
15+
16+
.App-header {
17+
background-color: #282c34;
18+
min-height: 100vh;
19+
display: flex;
20+
flex-direction: column;
21+
align-items: center;
22+
justify-content: center;
23+
font-size: calc(10px + 2vmin);
24+
color: white;
25+
}
26+
27+
.App-link {
28+
color: #61dafb;
29+
}
30+
31+
@keyframes App-logo-spin {
32+
from {
33+
transform: rotate(0deg);
34+
}
35+
to {
36+
transform: rotate(360deg);
37+
}
38+
}

‎src/App.test.tsx

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
import { render, screen } from '@testing-library/react';
3+
import App from './App';
4+
5+
test('renders learn react link', () => {
6+
render(<App />);
7+
const linkElement = screen.getByText(/learn react/i);
8+
expect(linkElement).toBeInTheDocument();
9+
});

‎src/App.tsx

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
import './App.css';
3+
4+
function App() {
5+
return (
6+
<div className="App">
7+
<header className="App-header">
8+
</header>
9+
</div>
10+
);
11+
}
12+
13+
export default App;

‎src/componentes/Cabecalho/estilos.css

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.cabecalho {
2+
display: flex;
3+
justify-content: space-around;
4+
padding-top: 120px;
5+
}
6+
7+
.imagem-logo {
8+
background-image: url("/public/imagens/logo.png");
9+
width: 351px;
10+
height: 117px;
11+
}
12+
13+
.participante {
14+
z-index: 1;
15+
}
16+
17+
@media screen and (max-width: 800px) {
18+
.cabecalho {
19+
padding-top: 60px;
20+
flex-direction: column;
21+
align-items: center;
22+
}
23+
24+
.imagem-logo {
25+
background-image: url("/public/imagens/logo-pequeno.png");
26+
width: 235px;
27+
height: 199px;
28+
}
29+
}

‎src/componentes/Cabecalho/index.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import './estilos.css'
2+
3+
const Cabecalho = () => {
4+
return (
5+
<header className="cabecalho">
6+
<div className="imagem-logo" role="img" aria-label='Logo do Sorteador'></div>
7+
<img className='participante' src="/imagens/participante.png" alt="Participante com um presente na mão" />
8+
</header>
9+
)
10+
}
11+
12+
export default Cabecalho

‎src/componentes/Formulario.test.tsx

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { render, screen } from "@testing-library/react";
2+
import React from "react";
3+
import Formulario from "./Formulario";
4+
5+
test('Quando o input estiver vazio, novos participantes não poderão ser adicionados', () => {
6+
render(<Formulario />)
7+
8+
// encontrar no DOM o input
9+
const input = screen.getByPlaceholderText('Insira os nomes dos participantes')
10+
11+
// encontrar o botão
12+
const botao = screen.getByRole('button')
13+
14+
// garantir que o input esteja no documento
15+
expect(input).toBeInTheDocument()
16+
17+
// garantir que o botão esteja desabilitado
18+
expect(botao).toBeDisabled()
19+
})

‎src/componentes/Formulario.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const Formulario = () => {
2+
return (<form>
3+
<input type="text" placeholder="Insira os nomes dos participantes"/>
4+
<button disabled={true}>Adicionar</button>
5+
</form>)
6+
}
7+
8+
export default Formulario

‎src/index.css

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
body {
2+
margin: 0;
3+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5+
sans-serif;
6+
-webkit-font-smoothing: antialiased;
7+
-moz-osx-font-smoothing: grayscale;
8+
}
9+
10+
code {
11+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12+
monospace;
13+
}

‎src/index.tsx

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import App from './App';
4+
import Cabecalho from './componentes/Cabecalho';
5+
6+
ReactDOM.render(
7+
<React.StrictMode>
8+
<Cabecalho />
9+
<App />
10+
</React.StrictMode>,
11+
document.getElementById('root')
12+
);
13+

‎src/react-app-env.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="react-scripts" />

‎src/reset.css

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
html {
2+
background: #4B69FD;
3+
border: 2px solid black;
4+
font-family: 'Poppins', sans-serif;
5+
}
6+
7+
#root {
8+
display: flex;
9+
flex-direction: column;
10+
min-height: 100vh;
11+
}

‎src/setupTests.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// jest-dom adds custom jest matchers for asserting on DOM nodes.
2+
// allows you to do things like:
3+
// expect(element).toHaveTextContent(/react/i)
4+
// learn more: https://github.com/testing-library/jest-dom
5+
import '@testing-library/jest-dom';

‎tsconfig.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"lib": [
5+
"dom",
6+
"dom.iterable",
7+
"esnext"
8+
],
9+
"allowJs": true,
10+
"skipLibCheck": true,
11+
"esModuleInterop": true,
12+
"allowSyntheticDefaultImports": true,
13+
"strict": true,
14+
"forceConsistentCasingInFileNames": true,
15+
"noFallthroughCasesInSwitch": true,
16+
"module": "esnext",
17+
"moduleResolution": "node",
18+
"resolveJsonModule": true,
19+
"isolatedModules": true,
20+
"noEmit": true,
21+
"jsx": "react-jsx"
22+
},
23+
"include": [
24+
"src"
25+
]
26+
}

0 commit comments

Comments
 (0)
Please sign in to comment.