Skip to content

Commit 5a06c61

Browse files
authored
Merge pull request #39 from areebsattar/RestaurantButton
NW-6 | AREEB-SATTAR | REACT| React Module Project - Restaurant button | WEEK-2
2 parents 686c6bb + 13d39f1 commit 5a06c61

5 files changed

Lines changed: 17 additions & 9 deletions

File tree

src/components/App/App.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const App = () => (
1515
</div>
1616
<Bookings />
1717
<Restaurant />
18-
1918
<Deck />
2019

2120
<Footer

src/components/Restaurant/Restaurant.jsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
import { useState } from "react";
2+
import RestaurantButton from "../RestaurantButton/RestaurantButton";
23

34
function Restaurant() {
45
const [pizzas, setPizzas] = useState(0);
56

6-
function buttonAdd() {
7+
const OrderOne = () => {
78
setPizzas(pizzas + 1);
8-
}
9+
};
910

1011
return (
1112
<section className="restaurant">
1213
<h3 className="restaurant__heading">Restaurant Orders</h3>
1314
<ul className="restaurant__list">
14-
<li className="restaurant__item">
15-
Pizzas: {pizzas}{" "}
16-
<button className="button restaurant__button" onClick={buttonAdd}>
17-
Add
18-
</button>
19-
</li>
15+
<li className="restaurant__item">Pizzas: {pizzas} </li>
2016
</ul>
17+
<RestaurantButton OrderOne={OrderOne} />
2118
</section>
2219
);
2320
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
function RestaurantButton({ OrderOne }) {
3+
return (
4+
<>
5+
<button type="button" className="button restaurant__button" onClick={OrderOne}>
6+
Add Pizzas
7+
</button>
8+
</>
9+
);
10+
}
11+
12+
export default RestaurantButton

src/components/RestaurantButton/RestaurantButton.scss

Whitespace-only changes.

src/components/RestaurantButton/RestaurantButton.test.jsx

Whitespace-only changes.

0 commit comments

Comments
 (0)