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

@ -1,10 +1,5 @@
import React from "react";
const Numbers = ({ numbers }) => {
// modifying array to array of li JSX
const list = numbers.map((num) => <li key={num}>{num}</li>);
return list;
};
import "./App.css";
const App = () => {
const numbers = [
@ -14,10 +9,25 @@ const App = () => {
return (
<div className="container">
<div>
<h1>Numbers List</h1>
<h1>30 Day os React</h1>
<h3>Number Generator</h3>
<div className="numbersContainer">
<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>
</div>
</div>

Loading…
Cancel
Save