From 1fcb465a883705853ba0ed8028786c3cc69d3019 Mon Sep 17 00:00:00 2001 From: Olga Zinoveva Date: Sat, 5 Oct 2019 21:27:45 +0200 Subject: [PATCH 1/2] done idCard and greetings --- src/App.js | 25 +++++++++++++++++++++--- src/components/Greetings.js | 23 ++++++++++++++++++++++ src/components/css/idCard.css | 10 ++++++++++ src/components/idCard.js | 36 +++++++++++++++++++++++++++++++++++ 4 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 src/components/Greetings.js create mode 100644 src/components/css/idCard.css create mode 100644 src/components/idCard.js diff --git a/src/App.js b/src/App.js index e7ca67f20..12831770d 100755 --- a/src/App.js +++ b/src/App.js @@ -1,14 +1,33 @@ -import React, { Component } from 'react'; +import React, { Component } from "react"; +import IdCard from "./components/idCard"; +import Greetings from "./components/Greetings"; class App extends Component { render() { return (

IdCard

- {/* TODO: Use the IdCard component */} + + +

Greetings

- {/* TODO: Use the Greetings component */} + Ludwig + François
); } diff --git a/src/components/Greetings.js b/src/components/Greetings.js new file mode 100644 index 000000000..c2c3a520a --- /dev/null +++ b/src/components/Greetings.js @@ -0,0 +1,23 @@ +import React, { Component } from "react"; + +class Greetings extends Component { + render() { + return ( +
+ {this.props.lang === "en" ? ( + Hello {this.props.children} + ) : null} + {this.props.lang === "es" ? ( + Hola {this.props.children} + ) : null} + {this.props.lang === "de" ? ( + Hallo {this.props.children} + ) : null} + {this.props.lang === "fr" ? ( + Bonjour {this.props.children} + ) : null} +
+ ); + } +} +export default Greetings; diff --git a/src/components/css/idCard.css b/src/components/css/idCard.css new file mode 100644 index 000000000..670b55f98 --- /dev/null +++ b/src/components/css/idCard.css @@ -0,0 +1,10 @@ +.card { + display: flex; + flex-direction: row; + border: solid 1px rgb(0, 0, 0); +} + +.cardText { + display: block; + flex-direction: column; +} diff --git a/src/components/idCard.js b/src/components/idCard.js new file mode 100644 index 000000000..97f9cdc51 --- /dev/null +++ b/src/components/idCard.js @@ -0,0 +1,36 @@ +import React, { Component } from "react"; +import "./css/idCard.css"; + +class IdCard extends Component { + render() { + return ( +
+ cardImage +
+

{this.props.lastName}

+

{this.props.firstName}

+

{this.props.gender}

+

{this.props.height}

+

{this.props.birth.toISOString()}

+
+
+ ); + } +} +export default IdCard; + +// const IdCard = props => { +// console.log(props); +// return ( +//
+// cardImage +//
+//

{props.lastName}

+//

{props.firstName}

+//

{props.gender}

+//

{props.height}

+//

{props.birth}

+//
+//
+// ); +// }; From e899fc926ed9b83d7b97aafd72641309a9d7a6b1 Mon Sep 17 00:00:00 2001 From: Olga Zinoveva Date: Sun, 6 Oct 2019 00:01:25 +0200 Subject: [PATCH 2/2] done with out css --- src/App.js | 81 ++++++++++++++++++++++++++++-------- src/components/BoxColor.js | 18 ++++++++ src/components/CreditCard.js | 30 +++++++++++++ src/components/Random.js | 16 +++++++ src/components/css/app.css | 4 ++ 5 files changed, 132 insertions(+), 17 deletions(-) create mode 100644 src/components/BoxColor.js create mode 100644 src/components/CreditCard.js create mode 100644 src/components/Random.js create mode 100644 src/components/css/app.css diff --git a/src/App.js b/src/App.js index 12831770d..8803b6d9e 100755 --- a/src/App.js +++ b/src/App.js @@ -1,33 +1,80 @@ import React, { Component } from "react"; 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 "./components/css/app.css"; class App extends Component { render() { return (
-

IdCard

- +
+

IdCard

+ - + +

Greetings

Ludwig François + +

Random

+ + +

BoxColor

+ + + +

CreditCard

+
+ + + +
); } diff --git a/src/components/BoxColor.js b/src/components/BoxColor.js new file mode 100644 index 000000000..b8a1b68e4 --- /dev/null +++ b/src/components/BoxColor.js @@ -0,0 +1,18 @@ +import React, { Component } from "react"; + +class BoxColor extends Component { + render() { + const divStyle = { + background: `rgb(${this.props.r},${this.props.g},${this.props.b})`, + width: `300px`, + height: `50px` + }; + return ( +
+ rgb({this.props.r},{this.props.g},{this.props.b}) +
+ ); + } +} + +export default BoxColor; diff --git a/src/components/CreditCard.js b/src/components/CreditCard.js new file mode 100644 index 000000000..e64ee3b44 --- /dev/null +++ b/src/components/CreditCard.js @@ -0,0 +1,30 @@ +import React, { Component } from "react"; + +class CreditCard extends Component { + render() { + const divStyle = { + background: this.props.bgColor, + color: this.props.color, + width: `300px`, + height: `170px` + }; + const hideNumber = number => { + return "**** **** **** " + number.slice(-4); + }; + + return ( +
+

{this.props.type}

+

{hideNumber(this.props.number)}

+

+ Expires {this.props.expirationMonth} + /{this.props.expirationYear} + {this.props.bank} +

+

{this.props.owner}

+
+ ); + } +} + +export default CreditCard; diff --git a/src/components/Random.js b/src/components/Random.js new file mode 100644 index 000000000..ec4564fcd --- /dev/null +++ b/src/components/Random.js @@ -0,0 +1,16 @@ +import React, { Component } from "react"; + +class Random extends Component { + render() { + return ( +
+ Random value beetween {this.props.min} and {this.props.max} =>{" "} + {Math.floor(Math.random() * (this.props.max - this.props.min + 1)) + + this.props.min} + ; +
+ ); + } +} + +export default Random; diff --git a/src/components/css/app.css b/src/components/css/app.css new file mode 100644 index 000000000..159cc9e26 --- /dev/null +++ b/src/components/css/app.css @@ -0,0 +1,4 @@ +.creditCard { + display: flex; + justify-content: space-around; +}