From e6a44b89a45d195c7ae64932304fdc6107d0919d Mon Sep 17 00:00:00 2001 From: KajalDeore04 Date: Fri, 10 Jan 2025 11:45:30 +0530 Subject: [PATCH] #268 - bug fix and style --- src/Pages/cake.js | 213 ++++++++++++++++++++++++++---- src/Pages/coffee.js | 289 ++++++++++++++++++++++++++++++++--------- src/Pages/milkshake.js | 205 ++++++++++++++++++++++++++--- src/Pages/soup.js | 200 +++++++++++++++++++++++++--- 4 files changed, 782 insertions(+), 125 deletions(-) diff --git a/src/Pages/cake.js b/src/Pages/cake.js index f05dddc..c170fd9 100644 --- a/src/Pages/cake.js +++ b/src/Pages/cake.js @@ -34,8 +34,8 @@ const ProductCard = styled(motion.div)` box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.1), -2px -2px 8px rgba(255, 255, 255, 0.8); transition: transform 0.3s ease, box-shadow 0.3s ease; cursor: pointer; - - &:hover { + z-index:50; +&:hover { transform: translateY(-5px); box-shadow: 6px 6px 15px rgba(0, 0, 0, 0.15), -4px -4px 12px rgba(255, 255, 255, 0.9); } @@ -43,12 +43,13 @@ const ProductCard = styled(motion.div)` &:hover .overlay { opacity: 1; } + `; const ProductImage = styled.img` width: 100%; height: 220px; - object-fit: cover; + object-fit:center; `; const Overlay = styled.div` @@ -73,7 +74,11 @@ const ProductName = styled.h3` font-weight: 600; box-sizing: border-box; `; - +const ProductInfo1 = styled.div` +display:flex; + align-items:center; + justify-content:space-between; +`; const OverlayText = styled.p` font-size: 1rem; color: #333; @@ -86,34 +91,165 @@ const ProductInfo = styled.div` `; const ProductPrice = styled.p` - font-size: 1.1rem; + font-size: 1.5rem; color: #4a2c2a; margin-bottom: 1rem; font-weight: 600; + text-align:center; `; const StyledButton = styled.button` - background: linear-gradient(145deg, #6b4f4f, #7d5858); - color: white; - border: none; - padding: 0.6rem 1.2rem; - font-size: 1rem; - border-radius: 20px; - cursor: pointer; - letter-spacing: 0.6px; - box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2); - transition: background 0.3s ease, transform 0.2s ease; + .CartBtn { + width: 140px; + height: 40px; + border-radius: 12px; + border: none; + background-color: rgb(255, 208, 0); + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + transition-duration: .5s; + overflow: hidden; + box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.103); + position: relative; + } - &:hover { - background: linear-gradient(145deg, #7d5858, #8e6a6a); - transform: scale(1.05); + .IconContainer { + position: absolute; + left: -50px; + width: 30px; + height: 30px; + background-color: transparent; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + overflow: hidden; + z-index: 2; + transition-duration: .5s; } - - &:active { - transform: scale(0.98); - box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3); + + .icon { + border-radius: 1px; + } + + .text { + height: 100%; + width: fit-content; + display: flex; + align-items: center; + justify-content: center; + color: rgb(17, 17, 17); + z-index: 1; + transition-duration: .5s; + font-size: 1.04em; + font-weight: 600; + } + + .CartBtn:hover .IconContainer { + transform: translateX(58px); + border-radius: 40px; + transition-duration: .5s; + } + + .CartBtn:hover .text { + transform: translate(10px,0px); + transition-duration: .5s; + } + + .CartBtn:active { + transform: scale(0.95); + transition-duration: .5s; } `; +const StyledWrapper = styled.div` + .heart-container { + --heart-color: maroon; + position: relative; + width: 50px; + height: 40px; + transition: .3s; + z-index:100; + + } + + .heart-container .checkbox { + position: absolute; + width: 100%; + height: 100%; + opacity: 0; + z-index: 20; + cursor: pointer; + } + + .heart-container .svg-container { + width:100%; + height: 100%; + display: flex; + justify-content: center; + align-items: center; + } + + .heart-container .svg-outline, + .heart-container .svg-filled { + fill: var(--heart-color); + position: absolute; + } + + .heart-container .svg-filled { + animation: keyframes-svg-filled 1s; + display: none; + } + + .heart-container .svg-celebrate { + position: absolute; + animation: keyframes-svg-celebrate .5s; + animation-fill-mode: forwards; + display: none; + stroke: var(--heart-color); + fill: var(--heart-color); + stroke-width: 2px; + } + + .heart-container .checkbox:checked~.svg-container .svg-filled { + display: block + } + + .heart-container .checkbox:checked~.svg-container .svg-celebrate { + display: block + } + + @keyframes keyframes-svg-filled { + 0% { + transform: scale(0); + } + + 25% { + transform: scale(1.2); + } + + 50% { + transform: scale(1); + filter: brightness(1.5); + } + } + + @keyframes keyframes-svg-celebrate { + 0% { + transform: scale(0); + } + + 50% { + opacity: 1; + filter: brightness(1.5); + } + + 100% { + transform: scale(1.4); + opacity: 0; + display: none; + }`; const products = [ { @@ -195,19 +331,48 @@ function Cake() { animate={{ opacity: 1, scale: 1 }} transition={{ duration: 0.5 }} > -
+
+ +
+ + + + + + + + + + + + + + + + +
+
+
{product.description}
+ {product.name} ${product.price.toFixed(2)} + + - handleAddToCart(product)}>Add to Cart + handleAddToCart(product)}> diff --git a/src/Pages/coffee.js b/src/Pages/coffee.js index 76a5ece..a845fc5 100644 --- a/src/Pages/coffee.js +++ b/src/Pages/coffee.js @@ -86,34 +86,172 @@ const ProductInfo = styled.div` `; const ProductPrice = styled.p` - font-size: 1.1rem; + font-size: 1.5rem; color: #4a2c2a; margin-bottom: 1rem; font-weight: 600; `; + + +const ProductInfo1 = styled.div` +display:flex; + align-items:center; + justify-content:space-between; +`; + const StyledButton = styled.button` - background: linear-gradient(145deg, #6b4f4f, #7d5858); - color: white; - border: none; - padding: 0.6rem 1.2rem; - font-size: 1rem; - border-radius: 20px; - cursor: pointer; - letter-spacing: 0.6px; - box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2); - transition: background 0.3s ease, transform 0.2s ease; + .CartBtn { + width: 140px; + height: 40px; + border-radius: 12px; + border: none; + background-color: rgb(255, 208, 0); + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + transition-duration: .5s; + overflow: hidden; + box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.103); + position: relative; + } - &:hover { - background: linear-gradient(145deg, #7d5858, #8e6a6a); - transform: scale(1.05); + .IconContainer { + position: absolute; + left: -50px; + width: 30px; + height: 30px; + background-color: transparent; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + overflow: hidden; + z-index: 2; + transition-duration: .5s; } - - &:active { - transform: scale(0.98); - box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3); + + .icon { + border-radius: 1px; + } + + .text { + height: 100%; + width: fit-content; + display: flex; + align-items: center; + justify-content: center; + color: rgb(17, 17, 17); + z-index: 1; + transition-duration: .5s; + font-size: 1.04em; + font-weight: 600; + } + + .CartBtn:hover .IconContainer { + transform: translateX(58px); + border-radius: 40px; + transition-duration: .5s; + } + + .CartBtn:hover .text { + transform: translate(10px,0px); + transition-duration: .5s; + } + + .CartBtn:active { + transform: scale(0.95); + transition-duration: .5s; } `; +const StyledWrapper = styled.div` + .heart-container { + --heart-color: maroon; + position: relative; + width: 50px; + height: 40px; + transition: .3s; + z-index:100; + + } + + .heart-container .checkbox { + position: absolute; + width: 100%; + height: 100%; + opacity: 0; + z-index: 20; + cursor: pointer; + } + + .heart-container .svg-container { + width:100%; + height: 100%; + display: flex; + justify-content: center; + align-items: center; + } + + .heart-container .svg-outline, + .heart-container .svg-filled { + fill: var(--heart-color); + position: absolute; + } + + .heart-container .svg-filled { + animation: keyframes-svg-filled 1s; + display: none; + } + + .heart-container .svg-celebrate { + position: absolute; + animation: keyframes-svg-celebrate .5s; + animation-fill-mode: forwards; + display: none; + stroke: var(--heart-color); + fill: var(--heart-color); + stroke-width: 2px; + } + + .heart-container .checkbox:checked~.svg-container .svg-filled { + display: block + } + + .heart-container .checkbox:checked~.svg-container .svg-celebrate { + display: block + } + + @keyframes keyframes-svg-filled { + 0% { + transform: scale(0); + } + + 25% { + transform: scale(1.2); + } + + 50% { + transform: scale(1); + filter: brightness(1.5); + } + } + + @keyframes keyframes-svg-celebrate { + 0% { + transform: scale(0); + } + + 50% { + opacity: 1; + filter: brightness(1.5); + } + + 100% { + transform: scale(1.4); + opacity: 0; + display: none; + }`; const products = [ { @@ -287,49 +425,78 @@ const products = [ }, ]; function Coffee() { - const dispatch = useDispatch(); - - const handleAddToCart = (product) => { - dispatch(addToCart(product)); - }; - - return ( - - - Our Coffee Selection - - - {products.map((product) => ( - -
- - - {product.description} - -
- - {product.name} - ${product.price.toFixed(2)} - - handleAddToCart(product)}>Add to Cart - - -
- ))} -
-
- ); + const dispatch = useDispatch(); + + const handleAddToCart = (product) => { + dispatch(addToCart(product)); + }; + + return ( + + + Our Cake Selection + + + {products.map((product) => ( + +
+ +
+ + + + + + + + + + + + + + + + +
+
+
+ + + {product.description} + +
+ + + {product.name} + ${product.price.toFixed(2)} + + + + handleAddToCart(product)}> + + +
+ ))} +
+
+ ); } export default Coffee; diff --git a/src/Pages/milkshake.js b/src/Pages/milkshake.js index 26ea863..2e94224 100644 --- a/src/Pages/milkshake.js +++ b/src/Pages/milkshake.js @@ -84,36 +84,171 @@ const ProductInfo = styled.div` padding: 1.25rem; background-color: white; `; - +const ProductInfo1 = styled.div` +display:flex; + align-items:center; + justify-content:space-between; +`; const ProductPrice = styled.p` - font-size: 1.1rem; + font-size: 1.5rem; color: #4a2c2a; margin-bottom: 1rem; font-weight: 600; `; const StyledButton = styled.button` - background: linear-gradient(145deg, #6b4f4f, #7d5858); - color: white; - border: none; - padding: 0.6rem 1.2rem; - font-size: 1rem; - border-radius: 20px; - cursor: pointer; - letter-spacing: 0.6px; - box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2); - transition: background 0.3s ease, transform 0.2s ease; + .CartBtn { + width: 140px; + height: 40px; + border-radius: 12px; + border: none; + background-color: rgb(255, 208, 0); + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + transition-duration: .5s; + overflow: hidden; + box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.103); + position: relative; + } - &:hover { - background: linear-gradient(145deg, #7d5858, #8e6a6a); - transform: scale(1.05); + .IconContainer { + position: absolute; + left: -50px; + width: 30px; + height: 30px; + background-color: transparent; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + overflow: hidden; + z-index: 2; + transition-duration: .5s; } - - &:active { - transform: scale(0.98); - box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3); + + .icon { + border-radius: 1px; + } + + .text { + height: 100%; + width: fit-content; + display: flex; + align-items: center; + justify-content: center; + color: rgb(17, 17, 17); + z-index: 1; + transition-duration: .5s; + font-size: 1.04em; + font-weight: 600; + } + + .CartBtn:hover .IconContainer { + transform: translateX(58px); + border-radius: 40px; + transition-duration: .5s; + } + + .CartBtn:hover .text { + transform: translate(10px,0px); + transition-duration: .5s; + } + + .CartBtn:active { + transform: scale(0.95); + transition-duration: .5s; } `; +const StyledWrapper = styled.div` + .heart-container { + --heart-color: maroon; + position: relative; + width: 50px; + height: 40px; + transition: .3s; + z-index:100; + + } + + .heart-container .checkbox { + position: absolute; + width: 100%; + height: 100%; + opacity: 0; + z-index: 20; + cursor: pointer; + } + + .heart-container .svg-container { + width:100%; + height: 100%; + display: flex; + justify-content: center; + align-items: center; + } + + .heart-container .svg-outline, + .heart-container .svg-filled { + fill: var(--heart-color); + position: absolute; + } + + .heart-container .svg-filled { + animation: keyframes-svg-filled 1s; + display: none; + } + + .heart-container .svg-celebrate { + position: absolute; + animation: keyframes-svg-celebrate .5s; + animation-fill-mode: forwards; + display: none; + stroke: var(--heart-color); + fill: var(--heart-color); + stroke-width: 2px; + } + + .heart-container .checkbox:checked~.svg-container .svg-filled { + display: block + } + + .heart-container .checkbox:checked~.svg-container .svg-celebrate { + display: block + } + + @keyframes keyframes-svg-filled { + 0% { + transform: scale(0); + } + + 25% { + transform: scale(1.2); + } + + 50% { + transform: scale(1); + filter: brightness(1.5); + } + } + + @keyframes keyframes-svg-celebrate { + 0% { + transform: scale(0); + } + + 50% { + opacity: 1; + filter: brightness(1.5); + } + + 100% { + transform: scale(1.4); + opacity: 0; + display: none; + }`; + const products = [ { @@ -230,7 +365,27 @@ function Milkshake() { initial={{ opacity: 0, scale: 0.9 }} animate={{ opacity: 1, scale: 1 }} transition={{ duration: 0.5 }} - > + >
+ +
+ + + + + + + + + + + + + + + + +
+
@@ -238,12 +393,20 @@ function Milkshake() {
+ {product.name} ${product.price.toFixed(2)} + - handleAddToCart(product)}>Add to Cart + handleAddToCart(product)}> + diff --git a/src/Pages/soup.js b/src/Pages/soup.js index 83ff8c4..74b8c03 100644 --- a/src/Pages/soup.js +++ b/src/Pages/soup.js @@ -86,33 +86,168 @@ const ProductInfo = styled.div` `; const ProductPrice = styled.p` - font-size: 1.1rem; + font-size: 1.5rem; color: #4a2c2a; margin-bottom: 1rem; font-weight: 600; `; const StyledButton = styled.button` - background: linear-gradient(145deg, #6b4f4f, #7d5858); - color: white; - border: none; - padding: 0.6rem 1.2rem; - font-size: 1rem; - border-radius: 20px; - cursor: pointer; - letter-spacing: 0.6px; - box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2); - transition: background 0.3s ease, transform 0.2s ease; + .CartBtn { + width: 140px; + height: 40px; + border-radius: 12px; + border: none; + background-color: rgb(255, 208, 0); + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + transition-duration: .5s; + overflow: hidden; + box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.103); + position: relative; + } - &:hover { - background: linear-gradient(145deg, #7d5858, #8e6a6a); - transform: scale(1.05); + .IconContainer { + position: absolute; + left: -50px; + width: 30px; + height: 30px; + background-color: transparent; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + overflow: hidden; + z-index: 2; + transition-duration: .5s; + } + + .icon { + border-radius: 1px; + } + + .text { + height: 100%; + width: fit-content; + display: flex; + align-items: center; + justify-content: center; + color: rgb(17, 17, 17); + z-index: 1; + transition-duration: .5s; + font-size: 1.04em; + font-weight: 600; + } + + .CartBtn:hover .IconContainer { + transform: translateX(58px); + border-radius: 40px; + transition-duration: .5s; + } + + .CartBtn:hover .text { + transform: translate(10px,0px); + transition-duration: .5s; + } + + .CartBtn:active { + transform: scale(0.95); + transition-duration: .5s; } +`; +const StyledWrapper = styled.div` + .heart-container { + --heart-color: maroon; + position: relative; + width: 50px; + height: 40px; + transition: .3s; + z-index:100; - &:active { - transform: scale(0.98); - box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3); } + + .heart-container .checkbox { + position: absolute; + width: 100%; + height: 100%; + opacity: 0; + z-index: 20; + cursor: pointer; + } + + .heart-container .svg-container { + width:100%; + height: 100%; + display: flex; + justify-content: center; + align-items: center; + } + + .heart-container .svg-outline, + .heart-container .svg-filled { + fill: var(--heart-color); + position: absolute; + } + + .heart-container .svg-filled { + animation: keyframes-svg-filled 1s; + display: none; + } + + .heart-container .svg-celebrate { + position: absolute; + animation: keyframes-svg-celebrate .5s; + animation-fill-mode: forwards; + display: none; + stroke: var(--heart-color); + fill: var(--heart-color); + stroke-width: 2px; + } + + .heart-container .checkbox:checked~.svg-container .svg-filled { + display: block + } + + .heart-container .checkbox:checked~.svg-container .svg-celebrate { + display: block + } + + @keyframes keyframes-svg-filled { + 0% { + transform: scale(0); + } + + 25% { + transform: scale(1.2); + } + + 50% { + transform: scale(1); + filter: brightness(1.5); + } + } + + @keyframes keyframes-svg-celebrate { + 0% { + transform: scale(0); + } + + 50% { + opacity: 1; + filter: brightness(1.5); + } + + 100% { + transform: scale(1.4); + opacity: 0; + display: none; + }`; + const ProductInfo1 = styled.div` +display:flex; + align-items:center; + justify-content:space-between; `; const products = [ @@ -194,7 +329,27 @@ function Soup() { initial={{ opacity: 0, scale: 0.9 }} animate={{ opacity: 1, scale: 1 }} transition={{ duration: 0.5 }} - > + >
+ +
+ + + + + + + + + + + + + + + + +
+
@@ -202,12 +357,19 @@ function Soup() {
+ {product.name} ${product.price.toFixed(2)} + - handleAddToCart(product)}>Add to Cart + handleAddToCart(product)}>