Skip to content

Commit

Permalink
Initial Application
Browse files Browse the repository at this point in the history
  • Loading branch information
estefaniacn committed Mar 6, 2022
1 parent f9b34dc commit 7fc5fce
Show file tree
Hide file tree
Showing 11 changed files with 123 additions and 73 deletions.
53 changes: 28 additions & 25 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
.App {
text-align: center;
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}

.App-logo {
height: 40vmin;
pointer-events: none;
html,
body {
background-color: #1b1b32;
}

@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
.App {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
padding-top: 15px;
font-family: Lato, sans-serif;
}

.App-header {
background-color: #282c34;
min-height: 100vh;
.freecodecamp-logo-contenedor {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
margin: 20px;
}

.App-link {
color: #61dafb;
.freecodecamp-logo {
height: 50px;
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.contenedor-principal {
height: 550px;
min-width: 600px;
display: flex;
flex-wrap: wrap;
flex-direction: column;
align-items: center;
justify-content: center;
}
49 changes: 33 additions & 16 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,40 @@
import logo from './logo.svg';
import './App.css';
import Boton from './componentes/Boton';
import Contador from './componentes/Contador';
import freeCodeCampLogo from './imagenes/freecodecamp-logo.png';
import { useState } from 'react';

function App() {

const [numClics, setNumClics] = useState(0);

const manejarClic = () => {
setNumClics(numClics + 1);
}

const reiniciarContador = () => {
setNumClics(0);
}

return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
<div className='App'>
<div className='freecodecamp-logo-contenedor'>
<img
className='freecodecamp-logo'
src={freeCodeCampLogo}
alt='Logo de freeCodeCamp' />
</div>
<div className='contenedor-principal'>
<Contador numClics={numClics} />
<Boton
texto='Clic'
esBotonDeClic={true}
manejarClic={manejarClic} />
<Boton
texto='Reiniciar'
esBotonDeClic={false}
manejarClic={reiniciarContador} />
</div>
</div>
);
}
Expand Down
8 changes: 0 additions & 8 deletions src/App.test.js

This file was deleted.

14 changes: 14 additions & 0 deletions src/componentes/Boton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import '../hojas-de-estilo/Boton.css';

function Boton({ texto, esBotonDeClic, manejarClic }) {
return (
<button
className={esBotonDeClic ? 'boton-clic' : 'boton-reiniciar'}
onClick={manejarClic}>
{texto}
</button>
);
}

export default Boton;
12 changes: 12 additions & 0 deletions src/componentes/Contador.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import '../hojas-de-estilo/Contador.css';

function Contador({ numClics }) {
return (
<div className='contador'>
{numClics}
</div>
);
}

export default Contador;
24 changes: 24 additions & 0 deletions src/hojas-de-estilo/Boton.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
button {
width: 250px;
height: 80px;
font-size: 35px;
font-family: Roboto, sans-serif;
font-weight: bold;
color: white;
border: 2px solid white;
border-radius: 15px;
margin: 5px;
cursor: pointer;
}

button:hover {
background-color: #00471b;
}

.boton-clic {
background-color: #002ead;
}

.boton-reiniciar {
background-color: #5a01a7;
}
12 changes: 12 additions & 0 deletions src/hojas-de-estilo/Contador.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.contador {
min-width: 300px;
height: 300px;
font-size: 160px;
padding: 25px;
color: white;
display: flex;
align-items: center;
justify-content: center;
border: 8px solid white;
margin-bottom: 15px;
}
Binary file added src/imagenes/freecodecamp-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 0 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@ import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
13 changes: 0 additions & 13 deletions src/reportWebVitals.js

This file was deleted.

5 changes: 0 additions & 5 deletions src/setupTests.js

This file was deleted.

0 comments on commit 7fc5fce

Please sign in to comment.