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.

109 changes: 79 additions & 30 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,38 +1,87 @@
.App {
text-align: center;
.cardPerson {
border: 1px solid black;
display: flex;
margin: 10px;
}
.cardPerson div {
margin-left: 20px;
}
.cardPerson img {
height: 80%;
margin: auto 5px;
}
.cardGreetings {
border: 1px solid black;
margin: 10px;
}
.cardGreetings p {
margin: 5px;
}

.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;
.BoxColor {
height: 150px;
border: 1px solid black;
margin: 10px 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
}
.CreditCard {
display: flex;
border: 1px solid black;
border-radius: 10px;
width: 30%;
height: 200px;
display: inline-block;
margin: 0 1.5%;
}
.CreditCard span {
margin-left: 40px;
}
.CreditCard img {
height: 25px;
margin: 20px 0 0 350px;
}
.CreditNumber {
text-align: center;
font-size: 24px;
letter-spacing: 10px;
}
.CreditInfo {
margin-left: 20px;
}
.CardDriver {
padding: 15px 0;
margin: 20px 100px;
border-radius: 10px;
background-color: rgb(63, 25, 202);
text-align: center;
color: white;
}

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

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
.CardDriver div {
display: flex;
display: inline-block;
}
.RatingDriver {
font-size: 30px;
}
.DriverImg {
height: 100px;
width: 100px;
margin-right: 20px;
border-radius: 50%;
}
.TitleDriver {
font-size: 26px;
font-weight: 800;
}
.likeButton {
padding: 15px 10px;
}
.Picture {
height: 200px;
}
.DiceFrame {
height: 100px;
margin-top: 300px;
}
127 changes: 110 additions & 17 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,118 @@
import React from 'react';
import logo from './logo.svg';
import IdCard from './Components/IdCard';
import Greetings from './Components/Greetings';
import Random from './Components/Random';
import BoxColor from './Components/BoxColor';
import CreditCard from './Components/CreditCard';
import Rating from './Components/Rating';
import DriverCard from './Components/DriverCard';
import LikeButton from './Components/LikeButton';
import ClickablePicture from './Components/ClickablePicture';
import imgGuy from './img/persons/maxence.png';
import imgGuyCliked from './img/persons/maxence-glasses.png';
import Dice from './Components/Dice';
import './App.css';

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>
</div>
<React.Fragment>
<div>
<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"
/>
</div>
<div>
<Greetings lang="de">Ludwig</Greetings>
<Greetings lang="fr">François</Greetings>
</div>
<div>
<Random min={1} max={6} />
<Random min={1} max={100} />
</div>
<div>
<BoxColor r={255} g={0} b={0} />
<BoxColor r={128} g={255} b={0} />
</div>
<div>
<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>
<div>
<Rating>0</Rating>
<Rating>1.49</Rating>
<Rating>1.5</Rating>
<Rating>3</Rating>
<Rating>4</Rating>
<Rating>5</Rating>
</div>
<div>
<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>
<LikeButton /> <LikeButton />
<div className="Picture">
<ClickablePicture img={imgGuy} imgClicked={imgGuyCliked} />
</div>
<Dice />
</React.Fragment>
);
}

Expand Down
24 changes: 24 additions & 0 deletions src/Components/BoxColor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';

function BoxColor(props) {
const r = props.r;
const g = props.g;
const b = props.b;
function RGB2HTML(red, green, blue) {
var decColor = 0x1000000 + blue + 0x100 * green + 0x10000 * red;
return '#' + decColor.toString(16).substr(1);
}
function color() {
return `rgb(${r},${g},${b})`;
}
return (
<div className="BoxColor" style={{ backgroundColor: color() }}>
<div>
rgb({r},{g},{b})
</div>
<div>{RGB2HTML(r, g, b)}</div>
</div>
);
}

export default BoxColor;
26 changes: 26 additions & 0 deletions src/Components/ClickablePicture.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React, { Component } from 'react';

export default class ClickablePicture extends Component {
state = {
open: true,
};
toggleImage = () => {
this.setState((state) => ({ open: !state.open }));
};

getImageName = () => (this.state.open ? 'plus' : 'minus');

render() {
const imagesPath = {
plus: this.props.img,
minus: this.props.imgClicked,
};

const imageName = this.getImageName();
return (
<div>
<img src={imagesPath[imageName]} onClick={this.toggleImage} />
</div>
);
}
}
51 changes: 51 additions & 0 deletions src/Components/CreditCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React from 'react';
import Visa from '../img/visa.png';
import MasterCard from '../img/master-card.svg';

function CreditCard(props) {
let creditNum = props.number;
function creditNumber(number) {
const strings = number.slice(-4).padStart(16, '*');
const result =
strings.substring(0, 4) +
' ' +
strings.substring(4, 8) +
' ' +
strings.substring(8, 12) +
' ' +
strings.substring(12, 16) +
' ' +
strings.substring(16, 20);
return result;
}

function imagenCard() {
let imagen = '';
switch (props.type) {
case 'Visa':
imagen = Visa;
break;
case 'Master Card':
imagen = MasterCard;
break;
}
return imagen;
}

return (
<div
className="CreditCard"
style={{ backgroundColor: props.bgColor, color: props.color }}
>
<img src={imagenCard()} />
<p className="CreditNumber">{creditNumber(creditNum)}</p>
<p className="CreditInfo">
{props.expirationMonth}/{props.expirationYear}
<span>{props.bank}</span>
<p>{props.owner}</p>
</p>
</div>
);
}

export default CreditCard;
Loading