Skip to content
Open

done + #1440

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
22 changes: 22 additions & 0 deletions src/components/CreditCard.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react'
import visa from '../assets/images/visa.png'
import masterCard from '../assets/images/master-card.svg'

/* eslint-disable react/prop-types */
function CreditCard(props) {
const { type, number, expirationMonth, expirationYear, bank, owner, bgColor, color } = props


return (
<div className="creditCard" style={{color: color, backgroundColor: bgColor}}>
<img src={type == 'Visa' ? visa : masterCard} className='cc'></img>
<p style={{fontSize: '25px', margin: '10px 0'}}>{"•••• •••• •••• " + number.slice(-4)}</p>
<p style={{textAlign: 'start'}}>Expires {expirationMonth}/{expirationYear.toString().slice(-2)}
<span style={{paddingLeft: '20px'}}>{bank}</span>
</p>
<p style={{textAlign: 'start'}}>{owner}</p>
</div>
)
}

export default CreditCard
12 changes: 12 additions & 0 deletions src/components/Greetings.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react'

function Greetings({ lang, children }) {

return (
<div>
<p>{children}</p>
</div>
)
}

export default Greetings
14 changes: 14 additions & 0 deletions src/components/IdCard.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function IdCard(props) {
return (
<div>
<img src={props.picture}></img>
<p>First name: {props.firstName}</p>
<p>Last name: {props.firstName}</p>
<p>Gender: {props.gender}</p>
<p>Height: {props.height}</p>
<p>Birth: {props.birth}</p>
</div>
)
}

export default IdCard
12 changes: 12 additions & 0 deletions src/components/Random.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react'

function Random({ min, max }) {
const displayedRandomNumber = Math.floor(Math.random() )
return (
<div>
<h3>{`Random value between ${min} and ${max} => ${displayedRandomNumber}`}</h3>
</div>
)
}

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

function Rating(props) {
const { children } = props

function convertToStars(rating) {
const roundedRating = Math.round(rating);
const filledStars = '★'.repeat(roundedRating);
const emptyStars = '☆'.repeat(5 - roundedRating);
return filledStars + emptyStars;
}

return (
<div>
{convertToStars(children)}
</div>
)
}

export default Rating
18 changes: 18 additions & 0 deletions src/components/boxColor.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'

function BoxColor(props) {
const { r, g, b } = props

function rgbToHex(r, g, b) {
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1).toUpperCase();
}

return (
<div className="container" style={{backgroundColor: `rgb(${r},${g},${b})`}}>
rgb({r},{g},{b})<br />
{rgbToHex(r,g,b)}
</div>
)
}

export default BoxColor