Skip to content
10 changes: 10 additions & 0 deletions components/boxcolor/boxcolor.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.cbox{
margin:10px;
padding:30px;
text-align: center;
border:2px solid #000000;
height: 100px;
font-weight:500;
font-size: xx-large;
display: flex;
}
15 changes: 15 additions & 0 deletions components/boxcolor/boxcolor.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import "./BoxColor.css"
function BoxColor(props)
{
const toHex = (number) => {
let hex = number.toString(16);
return hex.length === 1 ? "0" + hex : hex;
};
let color='#'+(toHex(props.r))+(toHex(props.g))+(toHex(props.b))
return <div className='cbox' style={{backgroundColor:color}}>
<p>rgb({props.r},{props.g},{props.b})</p>
<p>{color}</p>
</div>
}

export default BoxColor
12 changes: 12 additions & 0 deletions components/carousel/carousel.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.carousel{
display:flex;
width:100%;
justify-content:center;
align-items:center;
}
.carousel button{
padding:10px 15px;
}
.carousel img{
margin:10px;
}
26 changes: 26 additions & 0 deletions components/carousel/carousel.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import './Carousel.css'

function Carousel(props)
{
let arr=props.images
let len=arr.length
const[img_num , setImg]=React.useState(2)
function left()
{
if(img_num===0)
setImg(len-1)
else
setImg((img_num-1)%len)
}
function right()
{
setImg((img_num+1)%len)
}
return <div className='carousel'>
<button onClick={left}>Left</button>
<img src={arr[img_num]} alt='pic' style={{width:'300px'}}/>
<button onClick={right}>Right</button>
</div>
}
export default Carousel
14 changes: 14 additions & 0 deletions components/carousel/clickable.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
function Clickable(props)
{
const [img,putGlasses]=React.useState(props.img)
function glasses()
{
putGlasses(props.imgClicked)
}
return <div>
<img src={img} alt='pic' onClick={glasses} style={{width:'150px'}}/>
</div>
}

export default Clickable
16 changes: 16 additions & 0 deletions components/creditcard/creditcard.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.credit{
width:300px;
border-radius: 10px;
padding:18px;
height: 150px;

margin:5px;
display: inline-block;
}
.credit > div{
text-align: right;
}
.credit img{
width:50px;

}
23 changes: 23 additions & 0 deletions components/creditcard/creditcard.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import './CreditCard.css'
import visa from '../../assets/images/visa.png'
import mastercard from '../../assets/images/mastercard.png'
function CreditCard(props)
{
const img = props.type === 'Visa' ? visa : mastercard;
let mon=props.expirationMonth
let yr=props.expirationYear%100
let ex=''
if(mon<10)
ex='0'+mon+'/'+yr

return <div className='credit' style={{backgroundColor: props.bgColor,color:props.color}}>
<div>
<img src={img} alt='pic' />
</div>
<h1>.... .... .... {props.number.slice(12)}</h1>
<p>Expires {ex} {props.bank}</p>
<p>{props.owner}</p>
</div>;
}

export default CreditCard;
46 changes: 46 additions & 0 deletions components/creditcard/dice.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import dice0 from '../assets/images/dice-empty.png'
import dice1 from '../assets/images/dice1.png'
import dice2 from '../assets/images/dice2.png'
import dice3 from '../assets/images/dice3.png'
import dice4 from '../assets/images/dice4.png'
import dice5 from '../assets/images/dice5.png'
import dice6 from '../assets/images/dice6.png'

import React from 'react';

function Dice()
{
const [img, throwDice]=React.useState(dice0)
setInterval(change,1000)
function change()
{
let n=parseInt(Math.random()*6)
switch(n)
{
case 0:
throwDice(dice0)
break;
case 1:
throwDice(dice1)
break;
case 2:
throwDice(dice2)
break;
case 3:
throwDice(dice3)
break;
case 4:
throwDice(dice4)
break;
case 5:
throwDice(dice5)
break;
default :
throwDice(dice6)
break;
}
}
return <div> <img src={img} alt='dice' style={{width:'100px'}}/> </div>
}

export default Dice
17 changes: 17 additions & 0 deletions components/drivercard/drivercard.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.driver{
display: flex;
width:100%;
border-radius: 10px;
background-color: rgb(68, 118, 255);
justify-content: center;
align-items: center;
padding:25px;
margin:10px;
color: white;
}
.driver img{
width:100px;
height:100px;
border-radius: 50%;
margin-right: 15px;
}
17 changes: 17 additions & 0 deletions components/drivercard/drivercard.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import './DriverCard.css'
import Rating from '../Rating/Rating';
function DriverCard(props)
{
return <div className='driver'>
<div>
<img src={props.img} alt='pic' />
</div>
<div>
<h1>{props.name}</h1>
<Rating>{props.rating}</Rating>
<p>{props.car.model}-
{props.car.licensePlate}</p>
</div>

</div>
}
7 changes: 7 additions & 0 deletions components/greetings/greetings.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.greeting{
border: 2px solid black;
font-size: 30px;
font-weight: 500;
margin: 10px;
padding: 5px;
}
15 changes: 15 additions & 0 deletions components/greetings/greetings.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import "./Greetings.css";
const Greetings = (props) => {
let text;
if(props.lang === "de"){
text = "Hallo";
} else if(props.lang === "fr" || props.lang === "es"){
text = "Bonjour";
}
return(
<>
<h3 className="greetings">{text} {props.children}</h3>
</>
);
};
export default Greetings;