diff --git a/src/hooks/useInitialState.js b/src/hooks/useInitialState.js
index b4cb363..a13f482 100644
--- a/src/hooks/useInitialState.js
+++ b/src/hooks/useInitialState.js
@@ -1,31 +1,51 @@
import { useState } from "react";
const initialState = {
- cart: [],
-}
+ cart: [],
+ orderIsOpen: false,
+ menuIsOpen: false,
+};
const useInitialState = () => {
- const [state, setState] = useState(initialState);
-
- const addToCart = (payload) => {
- setState({
- ...state,
- cart: [...state.cart, payload]
- });
- };
-
- const removeFromCart = (payload) => {
- setState({
- ...state,
- cart: state.cart.filter(items => items.id !== payload.id),
- });
- }
-
- return {
- state,
- addToCart,
- removeFromCart
- }
-}
+ const [state, setState] = useState(initialState);
+
+ const addToCart = (payload) => {
+ setState({
+ ...state,
+ cart: state.cart.includes(payload)
+ ? state.cart
+ : [...state.cart, payload],
+ });
+ };
+
+ const removeFromCart = (payload) => {
+ setState({
+ ...state,
+ cart: state.cart.filter((items) => items.id !== payload.id),
+ });
+ };
+
+ const toggleOrder = () => {
+ setState({
+ ...state,
+ orderIsOpen: !state.orderIsOpen,
+ });
+ };
+
+ const toggleMenu = () => {
+ setState({
+ ...state,
+ menuIsOpen: !state.menuIsOpen,
+ });
+ };
+
+ return {
+ state,
+ addToCart,
+ removeFromCart,
+ toggleOrder,
+ toggleMenu,
+ };
+};
export default useInitialState;
diff --git a/src/styles/Menu.scss b/src/styles/Menu.scss
index 9a8e600..e818676 100644
--- a/src/styles/Menu.scss
+++ b/src/styles/Menu.scss
@@ -9,6 +9,7 @@
position: absolute;
top: 60px;
right: 50px;
+ background-color: white;
}
.Menu ul {
list-style: none;
diff --git a/src/styles/MyOrder.scss b/src/styles/MyOrder.scss
index d2f9783..fe3fe1b 100644
--- a/src/styles/MyOrder.scss
+++ b/src/styles/MyOrder.scss
@@ -45,7 +45,6 @@
text-align: end;
font-weight: bold;
}
-
.primary-button {
background-color: var(--hospital-green);
border-radius: 8px;
diff --git a/src/styles/OrderItem.scss b/src/styles/OrderItem.scss
index f29092a..2d6648b 100644
--- a/src/styles/OrderItem.scss
+++ b/src/styles/OrderItem.scss
@@ -22,4 +22,4 @@
.OrderItem p:nth-child(3) {
font-size: var(--md);
font-weight: bold;
-}
+}
\ No newline at end of file
diff --git a/src/styles/ProductItem.scss b/src/styles/ProductItem.scss
index e98b96b..7b4021f 100644
--- a/src/styles/ProductItem.scss
+++ b/src/styles/ProductItem.scss
@@ -34,6 +34,12 @@
margin-bottom: 0;
color: var(--very-light-pink);
}
+.add-to-cart-btn {
+ box-shadow: var(--very-light-pink) 0px 0px 2px;
+}
+.disabled {
+ cursor: not-allowed;
+}
@media (max-width: 640px) {
.cards-container {
grid-template-columns: repeat(auto-fill, 140px);
diff --git a/src/styles/global.css b/src/styles/global.css
index d476df7..ed4cac4 100644
--- a/src/styles/global.css
+++ b/src/styles/global.css
@@ -2,3 +2,10 @@ body {
margin: 0;
font-family: 'Quicksand', sans-serif;
}
+a[href], input[type='submit'], input[type='image'], label[for], select, button, .pointer {
+ cursor: pointer;
+}
+.more-clickable-area{
+ padding: 1em;
+ margin: -1em;
+}
\ No newline at end of file