diff --git a/src/Pages/OptiFiiGifsAndVouchers/BuyVoucher.jsx b/src/Pages/OptiFiiGifsAndVouchers/BuyVoucher.jsx index c9bfda4..f7f8736 100644 --- a/src/Pages/OptiFiiGifsAndVouchers/BuyVoucher.jsx +++ b/src/Pages/OptiFiiGifsAndVouchers/BuyVoucher.jsx @@ -1,5 +1,5 @@ import { Box, Button, Image, Text } from "@chakra-ui/react"; -import React from "react"; +import React, { useState } from "react"; import parkeAvenue from "../../assets/parkeAvenue.png"; import bewakoof from "../../assets/bewakoof.png"; import hm from "../../assets/HM.png"; @@ -25,25 +25,7 @@ import { FaPlane, FaHeart, } from "react-icons/fa"; - -const tabData = [ - { label: "All", icon: FaTv, content: }, - { label: "Electronics", icon: FaTv, content: "Content for Electronics" }, - { - label: "Ecommerce", - icon: FaShoppingCart, - content: "Content for Ecommerce", - }, - { label: "Lifestyle", icon: FaHeart, content: "Content for Lifestyle" }, - { - label: "Food & Beverages", - icon: FaUtensils, - content: "Content for Food & Beverages", - }, - { label: "Clothing", icon: FaTshirt, content: "Content for Clothing" }, - { label: "Travel", icon: FaPlane, content: "Content for Travel" }, - { label: "Lifestyle", icon: FaHeart, content: "Content for Lifestyle" }, -]; +import { useNavigate } from "react-router-dom"; const brands = [ { @@ -81,6 +63,38 @@ const brands = [ ]; const BuyVoucher = () => { + const [selectedCard, setSelectedCard] = useState(null); + const navigate = useNavigate(); + + const handleSelectCard = (index) => { + setSelectedCard(index); + }; + + const handleProceed = () => { + if (selectedCard !== null) { + navigate("/buy-voucher-card"); // Proceed with the selected card + } + }; + + const tabData = [ + { label: "All", icon: FaTv, content: }, + { label: "Electronics", icon: FaTv, content: "Content for Electronics" }, + { + label: "Ecommerce", + icon: FaShoppingCart, + content: "Content for Ecommerce", + }, + { label: "Lifestyle", icon: FaHeart, content: "Content for Lifestyle" }, + { + label: "Food & Beverages", + icon: FaUtensils, + content: "Content for Food & Beverages", + }, + { label: "Clothing", icon: FaTshirt, content: "Content for Clothing" }, + { label: "Travel", icon: FaPlane, content: "Content for Travel" }, + { label: "Lifestyle", icon: FaHeart, content: "Content for Lifestyle" }, + ]; + return ( { - + ); diff --git a/src/Pages/OptiFiiGifsAndVouchers/Tabs/AllVouchers.jsx b/src/Pages/OptiFiiGifsAndVouchers/Tabs/AllVouchers.jsx index 45a8678..860abfd 100644 --- a/src/Pages/OptiFiiGifsAndVouchers/Tabs/AllVouchers.jsx +++ b/src/Pages/OptiFiiGifsAndVouchers/Tabs/AllVouchers.jsx @@ -1,4 +1,4 @@ -import { Box, HStack, Text, VStack, Link } from "@chakra-ui/layout"; +import { Box, HStack, Text, VStack, Link , Grid} from "@chakra-ui/layout"; import React, { useEffect, useRef, useState } from "react"; import { OPACITY_ON_LOAD, SLIDE_IN_BOTTOM } from "../../../Layout/animations"; import amazonVoucher from "../../../assets/amazonlogo.png"; @@ -107,154 +107,132 @@ const brandData = [ }, ]; -const MyVoucher = () => { - const [selectedCard, setSelectedCard] = useState(null); - const navigate = useNavigate(); - - const handleSelectCard = (index) => { - setSelectedCard(index); - }; - - const handleProceed = () => { - if (selectedCard !== null) { - navigate("/buy-voucher-card"); // Proceed with the selected card - } - }; +const MyVoucher = ({handleSelectCard,handleProceed, selectedCard , setSelectedCard }) => { + const navigate = useNavigate(); return ( - - - {brandData?.map( - ( - { - brandColor, - brandLogo, - cardWorth, - brandName, - caption, - dateTime, - brandColor1, - textColor, - capColor, - }, - index - ) => { - const tiltRef = useRef(null); - - useEffect(() => { - const node = tiltRef.current; - if (node) { - VanillaTilt.init(node, { - max: 13, - speed: 700, - glare: true, - scale: 1.05, - "max-glare": 0.5, - onEnter: () => { - node.style.zIndex = 10; // Bring to top on hover - }, - onLeave: () => { - node.style.zIndex = 1; // Reset zIndex after hover - }, - }); + + + {brandData?.map( + ( + { + brandColor, + brandLogo, + cardWorth, + brandName, + caption, + dateTime, + brandColor1, + textColor, + capColor, + }, + index + ) => { + const tiltRef = useRef(null); + + useEffect(() => { + const node = tiltRef.current; + if (node) { + VanillaTilt.init(node, { + max: 13, + speed: 700, + glare: true, + scale: 1.05, + "max-glare": 0.5, + onEnter: () => { + node.style.zIndex = 10; // Bring to top on hover + }, + onLeave: () => { + node.style.zIndex = 1; // Reset zIndex after hover + }, + }); + } + return () => { + if (node && node.vanillaTilt) { + node.vanillaTilt.destroy(); } - return () => { - if (node && node.vanillaTilt) { - node.vanillaTilt.destroy(); - } - }; - }, [tiltRef]); - - return ( - + - + {/* */} + + + + - - {/* */} - - + {/* + $ {cardWorth} + */} + - - - 30% cashback + {caption} + + + + {brandName} - {/* - $ {cardWorth} - */} - - {caption} + + {dateTime} - - - {brandName} - - - {dateTime} - - {" "} - {/* Radio button for selecting the card */} - {/* */} - - - ); - } - )} - - + + + + ); + } + )} + + + ); };