add exercise 1

pull/157/head
diegobaena89 3 years ago
parent a06d0a1ac2
commit d395ba0e60

@ -1,38 +1,34 @@
.App { * {
text-align: center; margin: 0;
padding: 0;
} }
.App-logo { .container ul {
height: 40vmin; list-style: none;
pointer-events: none;
} }
@media (prefers-reduced-motion: no-preference) { .box {
.App-logo { width: 100px;
animation: App-logo-spin infinite 20s linear; height: 100px;
}
} }
.container {
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center;
justify-content: center; justify-content: center;
font-size: calc(10px + 2vmin); align-items: center;
color: white;
} }
.App-link { .numbersContainer {
color: #61dafb; max-width: 800px;
} }
@keyframes App-logo-spin { .numbersContainer ul {
from { display: flex;
transform: rotate(0deg); flex-wrap: wrap;
} margin: 1px 1px;
to { }
transform: rotate(360deg);
} .numbersContainer ul li {
display: flex;
margin: 1px;
} }

@ -1,10 +1,5 @@
import React from "react"; import React from "react";
import "./App.css";
const Numbers = ({ numbers }) => {
// modifying array to array of li JSX
const list = numbers.map((num) => <li key={num}>{num}</li>);
return list;
};
const App = () => { const App = () => {
const numbers = [ const numbers = [
@ -14,10 +9,25 @@ const App = () => {
return ( return (
<div className="container"> <div className="container">
<div> <h1>30 Day os React</h1>
<h1>Numbers List</h1> <h3>Number Generator</h3>
<div className="numbersContainer">
<ul> <ul>
<Numbers numbers={numbers} /> {/* <Numbers numbers={numbers} /> */}
{numbers.map((number) =>
number % 2 === 0 ? (
<li
className="box"
style={{ backgroundColor: "rgb(83, 187, 158)" }}
>
{number}
</li>
) : (
<li className="box" style={{ backgroundColor: "tomato" }}>
{number}
</li>
)
)}
</ul> </ul>
</div> </div>
</div> </div>

Loading…
Cancel
Save