Skip to content

Commit 2b4c48b

Browse files
committed
done
1 parent e1464f6 commit 2b4c48b

26 files changed

Lines changed: 535 additions & 5 deletions

src/App.jsx

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
import "./App.css";
2-
import BoxColor from "./components/boxColor/BoxColor";
3-
import CreditCard from "./components/creditCard/CreditCard";
4-
import DriverCard from "./components/driverCard/DriverCard";
2+
import BoxColor from "./components/box-color/BoxColor";
3+
import Carousel from "./components/carousel/Carousel";
4+
import ClickablePicture from "./components/clickable-picture/ClickablePicture";
5+
import CreditCard from "./components/credit-card/CreditCard";
6+
import Dice from "./components/dice/Dice";
7+
import DriverCard from "./components/driver-card/DriverCard";
8+
import Facebook from "./components/facebook/Facebook";
59
import Greetings from "./components/greetings/Greetings";
6-
import IdCard from "./components/idCard/IdCard";
10+
import IdCard from "./components/id-card/IdCard";
11+
import LikeButton from "./components/like-button/LikeButton";
12+
import NumbersTable from "./components/numbers-table/NumbersTable";
713
import Random from "./components/random/Random";
814
import Rating from "./components/rating/Rating";
15+
import RgbColorPicker from "./components/rgb-color-picker/RgbColorPicker";
16+
import SignupPage from "./components/signup-page/SignupPage";
917

1018
function App() {
1119
return (
@@ -65,8 +73,38 @@ function App() {
6573
<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" }} />
6674

6775
<h2>Iteration 8 | State: LikeButton</h2>
76+
<LikeButton colors={["purple", "blue", "green", "yellow", "orange", "red"]} />
77+
<LikeButton colors={["purple", "blue", "green", "yellow", "orange", "red"]} />
78+
79+
<h2>Iteration 9: State: ClickablePicture</h2>
80+
<ClickablePicture img="https://randomuser.me/api/portraits/women/44.jpg" imgClicked="../src/assets/images/glasses.png" />
81+
82+
<h2>Iteration 10 | State: Dice</h2>
83+
<Dice />
84+
85+
<h2>Iteration 11 | State: Carousel</h2>
86+
<Carousel images={[
87+
"https://randomuser.me/api/portraits/women/1.jpg",
88+
"https://randomuser.me/api/portraits/men/1.jpg",
89+
"https://randomuser.me/api/portraits/women/2.jpg",
90+
"https://randomuser.me/api/portraits/men/2.jpg"
91+
]}
92+
/>
93+
94+
<h2>Iteration 12 | List and Keys | NumbersTable</h2>
95+
<NumbersTable limit={24} />
96+
97+
<h2>Iterations 13 & 14 | List and Keys - FaceBook</h2>
98+
<Facebook />
99+
100+
<h2>Iteration 15 | Form - SignupPage</h2>
101+
<SignupPage />
102+
103+
<h2>Iteration 16 | Lifting State Up - RGBColorPicker</h2>
104+
<RgbColorPicker />
105+
68106
</div>
69107
);
70108
}
71109

72-
export default App;
110+
export default App;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.carousel {
2+
background-color: whitesmoke;
3+
display: flex;
4+
flex-direction: column;
5+
align-items: center;
6+
margin: 0.5rem;
7+
padding: 0.5rem;
8+
}
9+
10+
.carousel img {
11+
width: 175px;
12+
}
13+
14+
.carousel .btns {
15+
margin-top: 0.5rem;
16+
width: 175px;
17+
display: flex;
18+
justify-content: space-between;
19+
}
20+
21+
.carousel button {
22+
background-color: blueviolet;
23+
color: white;
24+
font-weight: bold;
25+
padding: 0.5rem 1rem;
26+
border-radius: 10px;
27+
border: none;
28+
min-width: 70px;
29+
}
30+
31+
.carousel button:hover {
32+
cursor: pointer;
33+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import "./Carousel.css";
2+
import { useState } from "react";
3+
4+
function Carousel({ images }) {
5+
6+
const [ index, setIndex ] = useState(0);
7+
8+
const handleLeft = () => {
9+
index ? setIndex(index - 1) : setIndex(images.length - 1);
10+
}
11+
12+
const handleRight = () => {
13+
(index === images.length - 1) ? setIndex(0) : setIndex(index + 1);
14+
}
15+
16+
return (
17+
<div className="carousel">
18+
<img src={images[index]} />
19+
<div className="btns">
20+
<button onClick={handleLeft} >Left</button>
21+
<button onClick={handleRight} >Right</button>
22+
</div>
23+
</div>
24+
);
25+
}
26+
27+
export default Carousel;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.div-clickable-container {
2+
display: flex;
3+
justify-content: center;
4+
}
5+
6+
.div-clickable-picture {
7+
position: relative;
8+
width: 200px;
9+
height: auto;
10+
}
11+
12+
.picture {
13+
width: 100%;
14+
height: auto;
15+
}
16+
17+
.glasses {
18+
width: 120px;
19+
position: absolute;
20+
top: 40px;
21+
left: 30px;
22+
transform: rotate(5deg);
23+
}
24+
25+
.picture:hover {
26+
cursor: pointer;
27+
}
28+
29+
.glasses:hover {
30+
cursor: pointer;
31+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import "./ClickablePicture.css";
2+
import { useState } from "react";
3+
4+
function ClickablePicture({ img, imgClicked }) {
5+
6+
const [ toggle, setToggle ] = useState(false);
7+
8+
const handleToggle = () => {
9+
setToggle(!toggle);
10+
}
11+
12+
return(
13+
<div className="div-clickable-container" >
14+
<div className="div-clickable-picture">
15+
<img className="picture" src={img} onClick={handleToggle} />
16+
{ toggle && (<img className="glasses" src={imgClicked} onClick={handleToggle} />) }
17+
</div>
18+
</div>
19+
);
20+
}
21+
22+
export default ClickablePicture;

src/components/dice/Dice.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.dice {
2+
width: 200px;
3+
}
4+
5+
.dice:hover {
6+
cursor: pointer;
7+
}

src/components/dice/Dice.jsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import "./Dice.css";
2+
import { useState } from "react";
3+
4+
function Dice() {
5+
6+
const [ randomDice, setRandomDice ] = useState(Math.floor(Math.random() * 6) + 1);
7+
8+
const handleClick = () => {
9+
setRandomDice("-empty");
10+
11+
setTimeout(() => {
12+
setRandomDice(Math.floor(Math.random() * 6) + 1);
13+
}, 1000);
14+
}
15+
16+
return (
17+
<div>
18+
<img className="dice" onClick={handleClick} src={`../src/assets/images/dice${randomDice}.png`} />
19+
</div>
20+
);
21+
}
22+
23+
export default Dice;

0 commit comments

Comments
 (0)