From afbc9d82c17980b9d9d5c940b2bbefbe25ef833c Mon Sep 17 00:00:00 2001 From: bender Date: Tue, 14 Apr 2026 09:09:50 +0000 Subject: [PATCH] Update src/app/page.tsx --- src/app/page.tsx | 168 ++++++++++++++--------------------------------- 1 file changed, 48 insertions(+), 120 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 53c684a..55ecd77 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -2,6 +2,7 @@ import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; import ReactLenis from "lenis/react"; +import { useState, useCallback } from "react"; import ContactSplitForm from '@/components/sections/contact/ContactSplitForm'; import FaqSplitMedia from '@/components/sections/faq/FaqSplitMedia'; import FooterLogoReveal from '@/components/sections/footer/FooterLogoReveal'; @@ -9,8 +10,29 @@ import HeroSplitDoubleCarousel from '@/components/sections/hero/HeroSplitDoubleC import NavbarStyleFullscreen from '@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen'; import ProductCardTwo from '@/components/sections/product/ProductCardTwo'; import TextSplitAbout from '@/components/sections/about/TextSplitAbout'; +import ProductCart from '@/components/ecommerce/cart/ProductCart'; export default function LandingPage() { + const [cartOpen, setCartOpen] = useState(false); + const [cartItems, setCartItems] = useState([]); + + const handleAddToCart = useCallback((product: any) => { + setCartItems(prev => { + const existing = prev.find(i => i.id === product.id); + if (existing) return prev.map(i => i.id === product.id ? { ...i, quantity: i.quantity + 1 } : i); + return [...prev, { ...product, quantity: 1 }]; + }); + setCartOpen(true); + }, []); + + const handleRemove = useCallback((id: string) => { + setCartItems(prev => prev.filter(i => i.id !== id)); + }, []); + + const handleQuantity = useCallback((id: string, qty: number) => { + setCartItems(prev => prev.map(i => i.id === id ? { ...i, quantity: qty } : i).filter(i => i.quantity > 0)); + }, []); + return ( + setCartOpen(false)} items={cartItems} onRemove={handleRemove} onQuantityChange={handleQuantity} total={cartItems.reduce((acc, item) => acc + (parseFloat(item.price) * item.quantity), 0).toFixed(2) + '€'} /> + @@ -122,29 +95,12 @@ export default function LandingPage() { animationType="slide-up" textboxLayout="split" gridVariant="bento-grid" - useInvertedBackground={false} products={[ - { - id: "p1", brand: "Smash", name: "Smash Classic", price: "12€", rating: 5, - reviewCount: "120", imageSrc: "http://img.b2bpic.net/free-photo/pink-hamburger-woman-holding-burger-with-tomato-lettuce-leaf-beef-patty-sauce-burger-buns_140725-10986.jpg"}, - { - id: "p2", brand: "Vegana", name: "Vegan Deluxe ⭐", price: "14€", rating: 5, - reviewCount: "90", imageSrc: "http://img.b2bpic.net/free-photo/front-view-male-holding-tray-with-burger-fries_23-2148678809.jpg"}, - { - id: "p3", brand: "Pollo", name: "Crispy Chicken", price: "11€", rating: 4, - reviewCount: "75", imageSrc: "http://img.b2bpic.net/free-photo/closeup-shot-sandwich-french-fries-table_181624-61641.jpg"}, - { - id: "p4", brand: "Picante", name: "Spicy Inferno", price: "13€", rating: 4, - reviewCount: "50", imageSrc: "http://img.b2bpic.net/free-photo/close-up-burger-with-egg_23-2148678846.jpg"}, - { - id: "p5", brand: "Clásico", name: "Cheese Burger", price: "10€", rating: 4, - reviewCount: "200", imageSrc: "http://img.b2bpic.net/free-photo/hamburger-with-egg-benedict-energy-drinks-can_114579-2137.jpg"}, - { - id: "p6", brand: "Postre", name: "Brownie Chocolate", price: "6€", rating: 5, - reviewCount: "80", imageSrc: "http://img.b2bpic.net/free-photo/front-view-cheeseburger-fries-with-copy-space_23-2148678815.jpg"}, + { id: "p1", brand: "Smash", name: "Smash Classic", price: "12€", rating: 5, reviewCount: "120", imageSrc: "http://img.b2bpic.net/free-photo/pink-hamburger-woman-holding-burger-with-tomato-lettuce-leaf-beef-patty-sauce-burger-buns_140725-10986.jpg", onProductClick: () => handleAddToCart({ id: "p1", name: "Smash Classic", price: "12", imageSrc: "..." }) }, + { id: "p2", brand: "Vegana", name: "Vegan Deluxe", price: "14€", rating: 5, reviewCount: "90", imageSrc: "http://img.b2bpic.net/free-photo/front-view-male-holding-tray-with-burger-fries_23-2148678809.jpg", onProductClick: () => handleAddToCart({ id: "p2", name: "Vegan Deluxe", price: "14", imageSrc: "..." }) }, ]} title="Nuestra Carta" - description="Descubre nuestra selección de hamburguesas, clásicos y opciones veganas." + description="Descubre nuestra selección de hamburguesas." /> @@ -153,59 +109,31 @@ export default function LandingPage() { textboxLayout="split" useInvertedBackground={true} faqs={[ - { - id: "f1", title: "¿Cómo pedir online?", content: "Para pedir online, por favor contacta directamente a través de nuestro formulario o llámanos al teléfono que aparece al final de la página."}, - { - id: "f2", title: "¿Se puede reservar?", content: "Sí, recomendamos reservar para cenar, especialmente fines de semana."}, - { - id: "f3", title: "¿Tienen opciones veganas?", content: "Sí, contamos con hamburguesas veganas muy populares."}, - { - id: "f4", title: "¿Tiempo de entrega?", content: "El tiempo estimado es de 35 a 55 minutos."}, + { id: "f1", title: "¿Cómo pedir online?", content: "Usa el botón de pedir online en la parte superior." }, ]} - imageSrc="http://img.b2bpic.net/free-photo/chef-cooking-kitchen-while-wearing-professional-attire_23-2151208271.jpg" mediaAnimation="slide-up" title="Preguntas frecuentes" - description="Resolvemos tus dudas sobre nuestro servicio y local." + description="Resolvemos tus dudas." faqsAnimation="blur-reveal" />
); -} +} \ No newline at end of file