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
40,048 changes: 40,048 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

38 changes: 6 additions & 32 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,38 +1,12 @@
.App {
text-align: center;
* {
margin: 1px;
padding: 1px;
}

.App-logo {
height: 40vmin;
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;
.Alineate {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}

.App-link {
color: #61dafb;
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
section {
margin-bottom: 30px;
}
119 changes: 104 additions & 15 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,113 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';
import Card from './IdCard';
import Greetings from './Greetings';
import Random from './Random';
import BoxColor from './BoxColor';
import CreditCard from './CreditCard';
import Ratting from './Ratting';

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>
</header>
<section>
<h1>Id Card</h1>

<Card
lastName='Doe'
firstName='John'
gender='male'
height={178}
birth={new Date("1992-07-14")}
picture="https://randomuser.me/api/portraits/men/44.jpg "
/>

<Card
lastName='Delores '
firstName='Obrien'
gender='female'
height={172}
birth={new Date("1988-05-11")}
picture="https://randomuser.me/api/portraits/women/44.jpg"
/>
</section>

<section>

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

</section>

<section>

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


</section>

<section>

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

</section>

<section>

<h1>Credit Card</h1>
<div className="Alineate">
<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>

</section>

<section>

<h1>Ratting</h1>

<Ratting>0</Ratting>
<Ratting>1.49</Ratting>
<Ratting>1.5</Ratting>
<Ratting>3</Ratting>
<Ratting>4</Ratting>
<Ratting>5</Ratting>

</section>



</div>
);
}
Expand Down
5 changes: 5 additions & 0 deletions src/BoxColor.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.box-color {
padding: 30px;
margin-bottom: 10px;
text-align: center;
}
19 changes: 19 additions & 0 deletions src/BoxColor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import "./BoxColor.css"

const BoxColor = (props) => {

const {r, g, b} = props

const divStyle = {
backgroundColor: `rgb(${r},${g},${b})`
};

return(
<div style={divStyle} className="box-color">
<p>rgb({r}, {g}, {b})</p>
</div>
)
}

export default BoxColor

27 changes: 27 additions & 0 deletions src/CreditCard.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.credit-card {
border-radius: 10px;
padding: 20px;
width: 20%;
margin: 1rem;
display: flex;
flex-wrap: wrap;
height: 10rem;
}

.first-row {
width: 100%;
}

.bank-logo {
max-height: 1.5rem;
}

.bank-name {
margin-left: 1rem;
}

.card-number {
width: 100%;
font-size: 2rem;
margin-bottom: 1rem;
}
45 changes: 45 additions & 0 deletions src/CreditCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React from 'react';
import "./CreditCard.css"

const CreditCard = (props) => {

const { type, number, expirationMonth, expirationYear, bank, owner, bgColor, color} = props

const bankLogo = (type) => {
switch(type) {
case "Visa":
return "/img/visa.png"
case "Master Card":
return "/img/master-card.svg"
default:
return "/img/visa.png"
}
}

const hidePassword = (string) => {

let hiddenPassword = string.slice(-4).padStart(16, "·")
return hiddenPassword.substring(0, 4) + " " + hiddenPassword.substring(4, 8) + " " + hiddenPassword.substring(8, 12) + " " + hiddenPassword.substring(12, 16)
}

const divStyle = {
backgroundColor: `${bgColor}`,
color: `${color}`
};

return(

<div className="credit-card" style={divStyle}>
<div className="first-row">
<img className="bank-logo" src={bankLogo(type)} alt={`${type} logo`}></img>
</div>
<p className="card-number"> {hidePassword(number)} </p>
<div className="client-info">
<p>Expires {expirationMonth.toString().padStart(2, '0')} / {expirationYear} <span className="bank-name"> {bank} </span> </p>
<p>{owner}</p>
</div>
</div>
)
}

export default CreditCard
6 changes: 6 additions & 0 deletions src/Greetings.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.box {
display: flex;
justify-content: flex-start;
margin-top: 10px;
border: 1px black solid;
}
39 changes: 39 additions & 0 deletions src/Greetings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from 'react';
import "./Greetings.css"


const Greetings = (props) => {
let greeting
switch (props.lang){
case "de":
greeting = "Hallo"
break

case "en":
greeting = "Hi"
break

case "es":
greeting = "Hola"
break

case "fr":
greeting = "Bonjour"
break

default:

greeting = "Ciao"
break
}

return (
<div class="box">
<p>{greeting}</p>
<p>{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 @@
.cards {
display: flex;
justify-content: flex-start;
margin-top: 5px;
border: 1px black solid;
}
.cards img {
width: 150px;
height: 150px;
padding-top: 10px;
padding-right: 10px;
}
25 changes: 25 additions & 0 deletions src/IdCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import "./IdCard.css"

const Idcard = (props) => {
return (

<div className="cards">

<div>
<img src={props.picture} alt={props.lastName} />
</div>

<div>
<p><strong>lastName:</strong> {props.lastName}</p>
<p><strong>firstName:</strong> {props.firstName}</p>
<p><strong>gender:</strong> {props.gender}</p>
<p><strong>height:</strong> {props.height/100}m</p>
<p><strong>birth:</strong> {props.birth.toDateString('')}</p>
</div>

</div>

)
}
export default Idcard;
6 changes: 6 additions & 0 deletions src/Random.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.box {
display: flex;
justify-content: flex-start;
margin-top: 10px;
border: 1px black solid;
}
15 changes: 15 additions & 0 deletions src/Random.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import "./Random.css"

const Random = (props) => {

const {min, max} = props
const randomNumber = (minVal, maxVal) => Math.floor((Math.random() * (max - min + 1) + min))

return (
<p className="box">Random value between {min} and {max} =&gt; {randomNumber(min, max)}</p>
)

}

export default Random
Empty file added src/Ratting.css
Empty file.
Loading