Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15,857 changes: 15,857 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

43 changes: 37 additions & 6 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,9 @@
pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}

.App-header {
background-color: #282c34;

min-height: 100vh;
display: flex;
flex-direction: column;
Expand All @@ -36,3 +31,39 @@
transform: rotate(360deg);
}
}

p {
margin: 5px;
}
.infos {
display: flex;
flex-direction: column;
align-items: flex-start;
}

.CreditCard {
max-width: 15rem;
border-radius: 20px;
display: flex;
flex-direction: column;
margin: 2rem;
padding: 1rem;
}

.type {
display: flex;
justify-content: flex-end;
}

.expiration {
display: flex;
flex-direction: row;
}

.owner {
display: flex;
justify-content: flex-start;
}



41 changes: 28 additions & 13 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';
import IdCard from './IdCard';
import Greetings from './Greetings';
import Random from './Random';
import BoxColor from './BoxColor';
import CreditCard from './CreditCard'

function App() {
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>
<IdCard lastName='Doe' firstName='John' gender='male' height={178} birth={new Date("1992-07-14")} picture="https://randomuser.me/api/portraits/men/44.jpg"/>
<IdCard lastName='Delores' firstName='Obrien' gender='female' height={172} birth={new Date("1988-05-11")} picture="https://randomuser.me/api/portraits/women/44.jpg"/>
</header>

<Greetings lang="de">Ludwig</Greetings>
<Greetings lang="fr">François</Greetings>

<Random min={1} max={6}/>
<Random min={1} max={100}/>

<BoxColor r={255} g={0} b={0} />
<BoxColor r={128} g={255} b={0} />

<CreditCard type="Visa" number="0123456789018845" expirationMonth={3} expirationYear={2021} bank="BNP" owner="Maxence Bouret" bgColor="#11aa99" color="white" />
<CreditCard type="Master Card" number="0123456789010995" expirationMonth={3} expirationYear={2021} bank="N26" owner="Maxence Bouret" bgColor="#eeeeee" color="#222222" />
<CreditCard type="Visa" number="0123456789016984" expirationMonth={12} expirationYear={2019} bank="Name of the Bank" owner="Firstname Lastname" bgColor="#ddbb55" color="white" />



</div>
);
}

export default App;




7 changes: 7 additions & 0 deletions src/BoxColor.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.colorBox{
width: 300px;
display: flex;
flex-direction: column;
margin: 2rem;
padding: 1rem;
}
9 changes: 9 additions & 0 deletions src/BoxColor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'
import './BoxColor.css';

const BoxColor = ({r,g,b}) => {

return <div className="colorBox" style={{ backgroundColor: `rgb(${r},${g},${b})`}}>rgb(${r},${g},${b})</div>
}

export default BoxColor;
8 changes: 8 additions & 0 deletions src/CreditCard.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.CreditCard {
max-width: 15rem;
border-radius: 20px;
display: flex;
justify-content: space-between;
margin: 2rem;
padding: 1rem;
}
28 changes: 28 additions & 0 deletions src/CreditCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react'
import './CreditCard.css';

function CreditCard(props) {
let styles = {
background: props.bgColor,
color: props.color,
};

return (
<div className="CreditCard" style={styles}>
<p className="type">{props.type}</p>
<p>{props.number}</p>
<div className="row">
<div className="expiration">
<p>
Expires {props.expirationMonth}/{props.expirationYear}
</p>
<p>{props.bank}</p>
</div>
</div>
<p className="owner">{props.owner}</p>
</div>
)
}

export default CreditCard;

7 changes: 7 additions & 0 deletions src/Greetings.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.card {
display: flex;
border: black 4px solid;
padding: 1rem;
margin: 2rem;
}

27 changes: 27 additions & 0 deletions src/Greetings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react'
import './Greetings.css'

const language = (lang) => {

if(lang === "de"){
return "Hallo"
} else if (lang === "en"){
return "Hello"
} else if (lang === "es"){
return "Hola"
} else if (lang === "fr"){
return "Bonjour"
}

}

const Greetings = (props) =>{

return (
<div className="card">
<p> {language(props.lang)}{props.children}</p>
</div>
);
}

export default Greetings
12 changes: 12 additions & 0 deletions src/IdCard.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.card {
display: flex;
border: black 4px solid;
padding: 1rem;
margin: 2rem;
color: black;
}

.card > img {
height: 15rem;
margin-right: 2rem;
}
24 changes: 24 additions & 0 deletions src/IdCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react'
import './IdCard.css'


const IdCard = (props) => {

const capitalize = (name) => name[0].toUpperCase() + name.slice(1)

return (
<article className="card">
<img src={props.picture} alt={props.name} />
<header>
<p>Last name: {capitalize(props.lastName)}</p>
<p>First name: {capitalize(props.firstName)}</p>
<p>Gender: {props.gender}</p>
<p>Height: {props.height/100}m</p>
<p>birth: {props.birth.toDateString()}</p>

</header>
</article>
)
}

export default IdCard
8 changes: 8 additions & 0 deletions src/Random.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.card {
display: flex;
border: black 4px solid;
padding: 1rem;
margin: 2rem;
font-size: 2em;
}

13 changes: 13 additions & 0 deletions src/Random.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react'
import './Random.css';

function Random(props) {
return (
<p className="card">
Random value between {props.min} and {props.max} is = {Math.floor(Math.random() * (props.max - props.min + 1)) + props.min};
</p>
);
}


export default Random;