Skip to content
Open

done #285

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
14 changes: 13 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 29 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,37 @@
import "./App.css";
import IdCard from "./components/IdCard";
import Greetings from "./components/Greetings";
import Random from "./components/Random";
import BoxColor from "./components/BoxColor";

function App() {
return (
<div className="App">
<h1> LAB | React Training</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"
/>

<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} />
</div>
);
}
Expand Down
9 changes: 9 additions & 0 deletions src/components/BoxColor.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'

export default function BoxColor(props) {
return (
<div style={{backgroundColor : `rgb(${props.r},${props.g},${props.b})`}}>
test
</div>
)
}
15 changes: 15 additions & 0 deletions src/components/Greetings.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react'

export default function Greetings(props) {
let massage;
if(props.lang === "de"){
massage = "hallo"
}else if(props.lang === "fr"){
massage = "bonjour"
}
return (
<div>
<p> {massage} {props.children}</p>
</div>
)
}
16 changes: 16 additions & 0 deletions src/components/IdCard.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react'

export default function IdCard(props) {
return (
<div>
<img src={props.picture} alt="" />
<div>
<p><span>lastName=</span> {props.lastName}</p>
<p><span>firstName= </span>{props.firstName}</p>
<p><span>gender=</span>{props.gender}</p>
<p><span>height=</span>{props.height}</p>
<p><span>birth=</span>{props.birth.toLocaleDateString()}</p>
</div>
</div>
)
}
10 changes: 10 additions & 0 deletions src/components/Random.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'

export default function Random(props) {
let resault = Math.floor(Math.random() * (props.max - props.min + 1)) + props.min;
return (
<div>
<p>random value between {props.min} and {props.max} is {resault}</p>
</div>
)
}