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
21 changes: 21 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#ffb733",
"activityBar.activeBorder": "#008053",
"activityBar.background": "#ffb733",
"activityBar.foreground": "#15202b",
"activityBar.inactiveForeground": "#15202b99",
"activityBarBadge.background": "#008053",
"activityBarBadge.foreground": "#e7e7e7",
"sash.hoverBorder": "#ffb733",
"statusBar.background": "#ffa500",
"statusBar.foreground": "#15202b",
"statusBarItem.hoverBackground": "#cc8400",
"statusBarItem.remoteBackground": "#ffa500",
"statusBarItem.remoteForeground": "#15202b",
"titleBar.activeBackground": "#ffa500",
"titleBar.activeForeground": "#15202b",
"titleBar.inactiveBackground": "#ffa50099",
"titleBar.inactiveForeground": "#15202b99"
}
}
15,857 changes: 15,857 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
h1 {
text-align: left;
margin-left: 20px;
}

.App {
text-align: center;
}
Expand Down
108 changes: 93 additions & 15 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,102 @@
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';
import Rating from './Rating';
import DriverCard from './DriverCard';

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>
<h1>IdCard</h1>
<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"
/>
<h1>Greetings</h1>
<Greetings lang="de" children="Ludwig" />
<Greetings lang="fr" children="François" />
<h1>Random</h1>
<Random min={1} max={6}/>
<Random min={1} max={100}/>
<h1>BoxColor</h1>
<BoxColor r={255} g={0} b={0} />
<BoxColor r={128} g={255} b={0} />
<h1>CreditCard</h1>
<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"
/>
<h1>Rating</h1>
<Rating>0</Rating>
<Rating>1.49</Rating>
<Rating>1.5</Rating>
<Rating>3</Rating>
<Rating>4</Rating>
<Rating>5</Rating>

<h1>DriverCard</h1>
<DriverCard
name="Travis Kalanick"
rating={4.2}
img="https://si.wsj.net/public/resources/images/BN-TY647_37gql_OR_20170621052140.jpg?width=620&height=428"
car={{
model: "Toyota Corolla Altis",
licensePlate: "CO42DE"
}}
/>
<DriverCard
name="Dara Khosrowshahi"
rating={4.9}
img="https://ubernewsroomapi.10upcdn.com/wp-content/uploads/2017/09/Dara_ELT_Newsroom_1000px.jpg"
car={{
model: "Audi A3",
licensePlate: "BE33ER"
}}
/>


</div>
);
}
Expand Down
7 changes: 7 additions & 0 deletions src/BoxColor.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.colorBox {
color: white;
border: 2px solid black;
margin: 10px 20px;
padding: 10px;
text-align: center;
}
8 changes: 8 additions & 0 deletions src/BoxColor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react'
import './BoxColor.css'

const BoxColor = (props) => {
return <p className='colorBox' style={{ backgroundColor: `rgb(${props.r},${props.g},${props.b})` }}>rgb({props.r},{props.g},{props.b})</p>
}

export default BoxColor
24 changes: 24 additions & 0 deletions src/CreditCard.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.creditCard {
border-radius: 10px;
margin: 10px;
margin-left: 20px;
padding: 20px;
width: 300px;
}

.cardType {
text-align: right;
margin: 0;
}

.cardNumber {
font-size: 29px;
}

.cardInfo {
text-align: left;
}

.cardInfo > p {
margin: 0;
}
17 changes: 17 additions & 0 deletions src/CreditCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react'
import './CreditCard.css'

const CreditCard = (props) => {
return (
<div className="creditCard" style={{ backgroundColor: `${props.bgColor}`, color: `${props.color}` }}>
<p className="cardType">{props.type}</p>
<p className="cardNumber">•••• •••• •••• {props.number.substr(-4)}</p>
<div className="cardInfo">
<p>Expires {props.expirationMonth}/{props.expirationYear % 2000} {props.bank}</p>
<p>{props.owner}</p>
</div>
</div>
)
}

export default CreditCard
31 changes: 31 additions & 0 deletions src/DriverCard.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.driverCard {
text-align: left;
background-color: #425cbb;
border-radius: 10px;
color: #fff;
padding: 15px;
display: flex;
justify-content: center;
align-items: center;
margin: 10px;
margin-left: 20px;
}

.driverCard > img {
margin: 10px;
width: 130px;
height: 130px;
object-fit: cover;
border-radius: 50%;
}

.driverBody > h2 {
font-size: 30px;
margin: 0;
}

.driverBody > p {
margin: 0;

}

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

const DriverCard = (props) => {
return (
<div className="driverCard">
<img src={props.img} alt={props.name}/>
<div className="driverBody">
<h2>{props.name}</h2>
<Rating children={props.rating} />
<p>{props.car.model} - {props.car.licensePlate}</p>
</div>
</div>
)
}

export default DriverCard
6 changes: 6 additions & 0 deletions src/Greetings.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.greeting {
border: 2px solid black;
margin: 10px 20px;
padding: 10px;
text-align: left;
}
22 changes: 22 additions & 0 deletions src/Greetings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react'
import './Greetings.css'

const Greetings = (props) => {
const lang = props.lang
let text

if (lang === 'de') {
text = 'Hallo'
} else if (lang ==='es') {
text = 'Hola'
} else if (lang ==='fr') {
text = 'Bonjour'
} else {
text = 'Hello'
}

return <p className='greeting'>{text} {props.children}</p>

}

export default Greetings
18 changes: 18 additions & 0 deletions src/IdCard.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.idCard {
display: flex;
align-items: flex-start;
border: 2px solid black;
margin: 10px 20px;
padding: 10px;
}

.idCard > img {
object-fit: contain;
height: 200px;
}

.cardBody {
padding-left: 10px;
text-align: left;
}

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

const IdCard = (props) => {
return (
<div className="idCard">
<img src={props.picture} alt={props.firstName} />
<div className="cardBody">
<p><strong>First name</strong>: {props.firstName}</p>
<p><strong>Last name</strong>: {props.lastName}</p>
<p><strong>Gender</strong>: {props.gender}</p>
<p><strong>Height</strong>: {Math.round((props.height/100) * 100) / 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 @@
.random {
border: 2px solid black;
margin: 10px 20px;
padding: 10px;
text-align: left;
}
10 changes: 10 additions & 0 deletions src/Random.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'
import './Random.css'

const Random = (props) => {
const random = Math.floor(Math.random() * (props.max - props.min + 1) + props.min)

return <p className='random'>Random value between {props.min} and {props.max} => {random}</p>
}

export default Random
6 changes: 6 additions & 0 deletions src/Rating.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.rating {
text-align: left;
font-size: 40px;
margin: 0;
margin-left: 20px;
}
23 changes: 23 additions & 0 deletions src/Rating.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react'
import './Rating.css'

const Rating = (props) => {
const stars = Math.round(props.children)

if (stars === 5) {
return <p className="rating">★★★★★</p>
} else if (stars === 4) {
return <p className="rating">★★★★☆</p>
} else if (stars === 3) {
return <p className="rating">★★★☆☆</p>
} else if (stars === 2) {
return <p className="rating">★★☆☆☆</p>
} else if (stars === 1) {
return <p className="rating">★☆☆☆☆</p>
} else if (stars === 0) {
return <p className="rating">☆☆☆☆☆</p>
}

}

export default Rating