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

Large diffs are not rendered by default.

115 changes: 99 additions & 16 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,107 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';
import IdCard from './Card';
import Greetings from './Greetings';
import Random from './Random';
import BoxColor from './BoxColor';
import CreditCard from './CreditCard';
import Rating from './Rating';
import DriverCard from './DriverCard';
// import Title from './Title'
// import Button from './Button'
import portrait1 from './img/persons/maxence.png'
// import portrait2 from './images/img2.jpeg'
// import portrait3 from './images/img3.png'
// import portrait4 from './images/img4.jpeg'
// import Square from './SquareClassComponent'

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>

<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"
/>

<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" />

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

<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
6 changes: 6 additions & 0 deletions src/BoxColor.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.colorbox {
width: 320px;
margin: 6px auto;
padding: 20px;
border: 1px solid black;
}
14 changes: 14 additions & 0 deletions src/BoxColor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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;

// rgb(205, 92, 92)

//<BoxColor r={255} g={0} b={0} />
//<BoxColor r={128} g={255} b={0} />
14 changes: 14 additions & 0 deletions src/Card.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.card {
width: 320px;
margin: 6px auto;
padding: 20px;
border: 1px solid black;
}

.card .title {
font-size: 24px;
}

.card img {
width: 140px;
}
22 changes: 22 additions & 0 deletions src/Card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react'
import './Card.css'


const Card = (props) => {

return (
<article className="card">
<img src={props.picture} alt={props.name} />
<div>
<p>First Name: {props.firstName}</p>
<p>Last Name: {props.lastName}</p>
<p>Gender: {props.gender}</p>
<p>Height: {props.height}</p>
<p>Birth: {props.birth.toString()}</p>

</div>
</article>
)
}

export default Card
7 changes: 7 additions & 0 deletions src/CreditCard.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.cc {
width: 500px;
height: 200px;
margin: 6px auto;
padding: 20px;
border: 1px solid black;
}
23 changes: 23 additions & 0 deletions src/CreditCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import './CreditCard.css';
import visapic from './img/visa.png';
import mcpic from './img/master-card.svg';


const CreditCard = (props) => {

return (
<div className="cc" style={{ backgroundColor: props.bgColor }}>
<img src={props.type === 'Visa' ? visapic : mcpic } style={{ width:40 }} alt={props.type} />
<div>
<p>{props.number}</p>
<p>Expires {props.expirationMonth}/{props.expirationYear}</p>
<p>{props.bank}</p>
<p>{props.owner}</p>

</div>
</div>
)
}

export default CreditCard;
17 changes: 17 additions & 0 deletions src/DriverCard.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.driverPic {
width: 200px;
height: 200px;
border-radius: 50%;
object-fit: cover;
}

.driver-card {
background-color: #425cbb;
border-radius: 10px;
padding: 15px;
display: flex;
justify-content: center;
align-items: center;
margin: 10px;
color: white;
}
21 changes: 21 additions & 0 deletions src/DriverCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react'
import './DriverCard.css'
import Rating from './Rating';


const DriverCard = (props) => {

return (
<article className="driver-card">
<img className="driverPic" src={props.img} alt={props.name} />
<div>
<p>{props.name}</p>
<Rating>{props.rating}</Rating>
<p>{props.car.model} - {props.car.licensePlate}</p>

</div>
</article>
)
}

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 @@
.h1 .greeter {
width: 320px;
margin: 6px auto;
padding: 20px;
border: 1px solid black;
}
19 changes: 19 additions & 0 deletions src/Greetings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react'
import './Greetings.css'

const Greetings = (props) => {

const lang = {
de: 'Hallo',
fr: 'Bonjour',
es: 'Holiwi',
en: 'Welcome',
}

return (
<p>{lang[props.lang]} {props.children}</p>
)

}

export default Greetings;
6 changes: 6 additions & 0 deletions src/Random.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.randombox {
width: 320px;
margin: 6px auto;
padding: 20px;
border: 1px solid black;
}
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 = ({min, max}) => {

return <p className="randombox">{Math.floor(Math.random() * (max - min + 1)) + min} </p>
}

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


const Rating = (props) => {
let estrellitas = "";
let batman = Math.floor(props.children)


if (batman === 0) {
estrellitas = '☆'
}
if (batman === 1) {
estrellitas = '★'
}
if (batman === 2) {
estrellitas = '★★☆☆☆'
}
if (batman === 3) {
estrellitas = '★★★☆☆'
}
if (batman === 4) {
estrellitas = '★★★★☆'
}
if (batman === 4) {
estrellitas = '★★★★★'
}

return <div>{estrellitas}</div>;
}

export default Rating


// ☆☆☆☆☆

// ★★★★★
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading