Download index.html from Alejo3007/website: direct link, hf CLI and curl.
- Browser
- Download file 24.5 kB
-
https://huggingface.co/spaces/Alejo3007/website/resolve/main/index.html
- Command line
-
hf download hf://spaces/Alejo3007/website/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Alejo3007/website/resolve/main/index.html
24.5 kB
| <html lang="es"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>DeliveEats - Comida a domicilio con Bizum</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <script src="https://unpkg.com/react@18/umd/react.development.js"></script> | |
| <script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script> | |
| <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script> | |
| <style> | |
| .dish-card:hover { | |
| transform: translateY(-5px); | |
| box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1); | |
| } | |
| .cart-item-enter { | |
| animation: slideIn 0.3s forwards; | |
| } | |
| .cart-item-exit { | |
| animation: slideOut 0.3s forwards; | |
| } | |
| @keyframes slideIn { | |
| from { transform: translateX(100%); opacity: 0; } | |
| to { transform: translateX(0); opacity: 1; } | |
| } | |
| @keyframes slideOut { | |
| from { transform: translateX(0); opacity: 1; } | |
| to { transform: translateX(100%); opacity: 0; } | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-50 font-sans"> | |
| <div id="root"></div> | |
| <script type="text/babel"> | |
| // Sample data for dishes | |
| const dishesData = [ | |
| { id: 1, name: "Pizza Margarita", description: "Clásica pizza con salsa de tomate, mozzarella y albahaca fresca.", price: 9.90, category: "pizza", image: "https://images.unsplash.com/photo-1513104890138-7c749659a591?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80" }, | |
| { id: 2, name: "Hamburguesa Clásica", description: "Carne 100% vacuno, lechuga, tomate, cebolla y salsa especial.", price: 7.50, category: "burger", image: "https://images.unsplash.com/photo-1568901346375-23c9450c58cd?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80" }, | |
| { id: 3, name: "Sushi Variado", description: "12 piezas de sushi variado: salmón, atún, pepino y aguacate.", price: 12.90, category: "sushi", image: "https://images.unsplash.com/photo-1579871494447-9811cf80d66c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80" }, | |
| { id: 4, name: "Tacos al Pastor", description: "3 tacos con carne adobada, piña, cebolla y cilantro.", price: 8.50, category: "mexican", image: "https://images.unsplash.com/photo-1613514785940-daed07799d9b?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80" }, | |
| { id: 5, name: "Pad Thai", description: "Fideos de arroz salteados con verduras, huevo y cacahuetes.", price: 10.50, category: "asian", image: "https://images.unsplash.com/photo-1516684732162-798a0062be99?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80" }, | |
| { id: 6, name: "Tarta de Chocolate", description: "Deliciosa tarta de chocolate negro con base crujiente.", price: 5.50, category: "dessert", image: "https://images.unsplash.com/photo-1564355808539-22fda35bed7e?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80" }, | |
| { id: 7, name: "Pizza Pepperoni", description: "Pizza con salsa de tomate, mozzarella y abundante pepperoni.", price: 10.90, category: "pizza", image: "https://images.unsplash.com/photo-1601924582970-9238bcb495d9?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80" }, | |
| { id: 8, name: "Hamburguesa Doble", description: "Doble carne, doble queso, bacon, lechuga, tomate y salsa BBQ.", price: 9.50, category: "burger", image: "https://images.unsplash.com/photo-1568901346375-23c9450c58cd?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80" } | |
| ]; | |
| // Categories data | |
| const categories = [ | |
| { id: "pizza", name: "Pizzas", icon: "fa-pizza-slice" }, | |
| { id: "burger", name: "Hamburguesas", icon: "fa-hamburger" }, | |
| { id: "sushi", name: "Sushi", icon: "fa-fish" }, | |
| { id: "mexican", name: "Mexicana", icon: "fa-pepper-hot" }, | |
| { id: "asian", name: "Asiática", icon: "fa-utensils" }, | |
| { id: "dessert", name: "Postres", icon: "fa-ice-cream" } | |
| ]; | |
| // Header Component | |
| function Header({ cartCount, onCartClick }) { | |
| return ( | |
| <header className="bg-green-600 text-white shadow-lg sticky top-0 z-50"> | |
| <div className="container mx-auto px-4 py-3 flex justify-between items-center"> | |
| <div className="flex items-center space-x-2"> | |
| <i className="fas fa-utensils text-2xl"></i> | |
| <h1 className="text-2xl font-bold">DeliveEats</h1> | |
| </div> | |
| <div className="flex items-center space-x-4"> | |
| <button onClick={onCartClick} className="relative"> | |
| <i className="fas fa-shopping-cart text-xl"></i> | |
| <span className="absolute -top-2 -right-2 bg-red-500 text-white text-xs rounded-full h-5 w-5 flex items-center justify-center"> | |
| {cartCount} | |
| </span> | |
| </button> | |
| <button className="bg-white text-green-600 px-4 py-1 rounded-full font-medium hover:bg-gray-100 transition"> | |
| Iniciar sesión | |
| </button> | |
| </div> | |
| </div> | |
| </header> | |
| ); | |
| } | |
| // Hero Section Component | |
| function HeroSection() { | |
| return ( | |
| <section className="bg-gradient-to-r from-green-500 to-green-600 text-white py-12"> | |
| <div className="container mx-auto px-4 text-center"> | |
| <h2 className="text-4xl font-bold mb-4">Comida deliciosa en tu puerta</h2> | |
| <p className="text-xl mb-6">Pide ahora y paga fácilmente con Bizum</p> | |
| <div className="max-w-md mx-auto relative"> | |
| <input | |
| type="text" | |
| placeholder="¿Qué te apetece hoy?" | |
| className="w-full px-4 py-3 rounded-full text-gray-800 focus:outline-none" | |
| /> | |
| <button className="absolute right-2 top-1/2 transform -translate-y-1/2 bg-green-600 text-white p-2 rounded-full"> | |
| <i className="fas fa-search"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </section> | |
| ); | |
| } | |
| // Categories Component | |
| function Categories({ onCategorySelect }) { | |
| return ( | |
| <section className="container mx-auto px-4 py-8"> | |
| <h3 className="text-2xl font-bold mb-6">Categorías</h3> | |
| <div className="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4"> | |
| {categories.map(category => ( | |
| <button | |
| key={category.id} | |
| onClick={() => onCategorySelect(category.id)} | |
| className="category-btn bg-white p-4 rounded-lg shadow-md flex flex-col items-center hover:bg-green-50 transition" | |
| > | |
| <i className={`fas ${category.icon} text-3xl text-green-600 mb-2`}></i> | |
| <span>{category.name}</span> | |
| </button> | |
| ))} | |
| </div> | |
| </section> | |
| ); | |
| } | |
| // Dish Card Component | |
| function DishCard({ dish, onAddToCart }) { | |
| return ( | |
| <div className="dish-card bg-white rounded-lg shadow-md overflow-hidden transition duration-300"> | |
| <img src={dish.image} alt={dish.name} className="w-full h-48 object-cover" /> | |
| <div className="p-4"> | |
| <h4 className="font-bold text-lg mb-1">{dish.name}</h4> | |
| <p className="text-gray-600 text-sm mb-3">{dish.description}</p> | |
| <div className="flex justify-between items-center"> | |
| <span className="font-bold text-green-600">{dish.price.toFixed(2)}€</span> | |
| <button | |
| onClick={() => onAddToCart(dish.id)} | |
| className="add-to-cart bg-green-600 text-white px-3 py-1 rounded hover:bg-green-700 transition" | |
| > | |
| Añadir | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| ); | |
| } | |
| // Dishes Section Component | |
| function DishesSection({ dishes, onAddToCart }) { | |
| return ( | |
| <section className="container mx-auto px-4 py-8"> | |
| <div className="flex justify-between items-center mb-6"> | |
| <h3 className="text-2xl font-bold">Platos populares</h3> | |
| <button className="text-green-600 font-medium">Ver todos</button> | |
| </div> | |
| <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> | |
| {dishes.map(dish => ( | |
| <DishCard key={dish.id} dish={dish} onAddToCart={onAddToCart} /> | |
| ))} | |
| </div> | |
| </section> | |
| ); | |
| } | |
| // Cart Item Component | |
| function CartItem({ item, onUpdateQuantity, onRemoveItem }) { | |
| return ( | |
| <div className="cart-item-enter flex justify-between items-center mb-4 pb-4 border-b"> | |
| <div> | |
| <h4 className="font-medium">{item.name}</h4> | |
| <div className="flex items-center mt-1"> | |
| <button | |
| onClick={() => onUpdateQuantity(item.id, 'decrease')} | |
| className="quantity-btn text-gray-500 px-2" | |
| > | |
| <i className="fas fa-minus text-xs"></i> | |
| </button> | |
| <span className="mx-2">{item.quantity}</span> | |
| <button | |
| onClick={() => onUpdateQuantity(item.id, 'increase')} | |
| className="quantity-btn text-gray-500 px-2" | |
| > | |
| <i className="fas fa-plus text-xs"></i> | |
| </button> | |
| </div> | |
| </div> | |
| <div className="flex items-center"> | |
| <span className="font-medium mr-4">{(item.price * item.quantity).toFixed(2)}€</span> | |
| <button | |
| onClick={() => onRemoveItem(item.id)} | |
| className="remove-btn text-red-500" | |
| > | |
| <i className="fas fa-trash"></i> | |
| </button> | |
| </div> | |
| </div> | |
| ); | |
| } | |
| // Cart Sidebar Component | |
| function CartSidebar({ | |
| isOpen, | |
| onClose, | |
| cartItems, | |
| subtotal, | |
| total, | |
| onUpdateQuantity, | |
| onRemoveItem, | |
| onCheckout, | |
| bizumPhone, | |
| onBizumPhoneChange, | |
| isCheckoutDisabled | |
| }) { | |
| return ( | |
| <> | |
| <div | |
| className={`fixed top-0 right-0 h-full w-full md:w-96 bg-white shadow-lg transform ${isOpen ? 'translate-x-0' : 'translate-x-full'} transition-transform duration-300 z-50 overflow-y-auto`} | |
| > | |
| <div className="p-4"> | |
| <div className="flex justify-between items-center mb-6"> | |
| <h3 className="text-xl font-bold">Tu pedido</h3> | |
| <button onClick={onClose} className="text-gray-500 hover:text-gray-700"> | |
| <i className="fas fa-times"></i> | |
| </button> | |
| </div> | |
| <div className="mb-4"> | |
| {cartItems.length === 0 ? ( | |
| <div className="text-center py-8 text-gray-500"> | |
| <i className="fas fa-shopping-cart text-4xl mb-2"></i> | |
| <p>Tu carrito está vacío</p> | |
| </div> | |
| ) : ( | |
| cartItems.map(item => ( | |
| <CartItem | |
| key={item.id} | |
| item={item} | |
| onUpdateQuantity={onUpdateQuantity} | |
| onRemoveItem={onRemoveItem} | |
| /> | |
| )) | |
| )} | |
| </div> | |
| {cartItems.length > 0 && ( | |
| <div className="border-t pt-4"> | |
| <div className="flex justify-between mb-2"> | |
| <span>Subtotal:</span> | |
| <span>{subtotal.toFixed(2)}€</span> | |
| </div> | |
| <div className="flex justify-between mb-2"> | |
| <span>Envío:</span> | |
| <span>2.50€</span> | |
| </div> | |
| <div className="flex justify-between font-bold text-lg"> | |
| <span>Total:</span> | |
| <span>{total.toFixed(2)}€</span> | |
| </div> | |
| <div className="mt-6 bg-green-50 p-4 rounded-lg"> | |
| <h4 className="font-bold mb-2 flex items-center"> | |
| <i className="fas fa-mobile-alt text-green-600 mr-2"></i> Pago con Bizum | |
| </h4> | |
| <p className="text-sm text-gray-600 mb-3"> | |
| Introduce tu número de teléfono para recibir la solicitud de pago | |
| </p> | |
| <input | |
| type="tel" | |
| value={bizumPhone} | |
| onChange={(e) => onBizumPhoneChange(e.target.value)} | |
| placeholder="Número de teléfono" | |
| className="w-full px-3 py-2 border rounded mb-2" | |
| pattern="[0-9]{9}" | |
| /> | |
| <button | |
| onClick={onCheckout} | |
| disabled={isCheckoutDisabled} | |
| className={`w-full bg-green-600 text-white py-3 rounded-lg font-bold hover:bg-green-700 transition ${isCheckoutDisabled ? 'opacity-50 cursor-not-allowed' : ''}`} | |
| > | |
| Finalizar pedido | |
| </button> | |
| </div> | |
| </div> | |
| )} | |
| </div> | |
| </div> | |
| <div | |
| className={`fixed inset-0 bg-black bg-opacity-50 z-40 ${isOpen ? 'block' : 'hidden'}`} | |
| onClick={onClose} | |
| ></div> | |
| </> | |
| ); | |
| } | |
| // Confirmation Modal Component | |
| function ConfirmationModal({ isOpen, onClose }) { | |
| return ( | |
| <div className={`fixed inset-0 flex items-center justify-center z-50 ${isOpen ? 'block' : 'hidden'}`}> | |
| <div className="bg-white rounded-lg shadow-xl max-w-md w-full p-6 mx-4"> | |
| <div className="text-center"> | |
| <i className="fas fa-check-circle text-5xl text-green-500 mb-4"></i> | |
| <h3 className="text-2xl font-bold mb-2">¡Pedido confirmado!</h3> | |
| <p className="mb-4">Hemos enviado una solicitud de pago por Bizum al número proporcionado.</p> | |
| <p className="text-sm text-gray-500 mb-6"> | |
| Una vez confirmado el pago, comenzaremos a preparar tu pedido. | |
| </p> | |
| <button | |
| onClick={onClose} | |
| className="bg-green-600 text-white px-6 py-2 rounded-lg font-medium hover:bg-green-700 transition" | |
| > | |
| Entendido | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| ); | |
| } | |
| // Main App Component | |
| function App() { | |
| const [dishes, setDishes] = React.useState(dishesData); | |
| const [cartItems, setCartItems] = React.useState([]); | |
| const [isCartOpen, setIsCartOpen] = React.useState(false); | |
| const [bizumPhone, setBizumPhone] = React.useState(''); | |
| const [isModalOpen, setIsModalOpen] = React.useState(false); | |
| // Calculate cart totals | |
| const subtotal = cartItems.reduce((sum, item) => sum + (item.price * item.quantity), 0); | |
| const deliveryFee = 2.50; | |
| const total = subtotal + deliveryFee; | |
| const cartCount = cartItems.reduce((sum, item) => sum + item.quantity, 0); | |
| // Check if checkout button should be enabled | |
| const isCheckoutDisabled = !(bizumPhone.length === 9 && /^\d+$/.test(bizumPhone) && cartItems.length > 0); | |
| // Filter dishes by category | |
| const filterDishes = (category) => { | |
| if (category === 'all') { | |
| setDishes(dishesData); | |
| } else { | |
| const filteredDishes = dishesData.filter(dish => dish.category === category); | |
| setDishes(filteredDishes); | |
| } | |
| }; | |
| // Add item to cart | |
| const addToCart = (dishId) => { | |
| const dish = dishesData.find(d => d.id === dishId); | |
| setCartItems(prevItems => { | |
| const existingItem = prevItems.find(item => item.id === dishId); | |
| if (existingItem) { | |
| return prevItems.map(item => | |
| item.id === dishId | |
| ? { ...item, quantity: item.quantity + 1 } | |
| : item | |
| ); | |
| } else { | |
| return [...prevItems, { ...dish, quantity: 1 }]; | |
| } | |
| }); | |
| // Open cart if it's closed | |
| if (!isCartOpen) { | |
| setIsCartOpen(true); | |
| } | |
| }; | |
| // Update item quantity in cart | |
| const updateQuantity = (itemId, action) => { | |
| setCartItems(prevItems => { | |
| return prevItems.map(item => { | |
| if (item.id === itemId) { | |
| if (action === 'increase') { | |
| return { ...item, quantity: item.quantity + 1 }; | |
| } else if (action === 'decrease' && item.quantity > 1) { | |
| return { ...item, quantity: item.quantity - 1 }; | |
| } | |
| } | |
| return item; | |
| }).filter(item => item.quantity > 0); | |
| }); | |
| }; | |
| // Remove item from cart | |
| const removeFromCart = (itemId) => { | |
| setCartItems(prevItems => prevItems.filter(item => item.id !== itemId)); | |
| }; | |
| // Handle checkout | |
| const handleCheckout = () => { | |
| // In a real app, you would send this data to your backend | |
| const order = { | |
| items: cartItems, | |
| phone: bizumPhone, | |
| subtotal: subtotal, | |
| total: total, | |
| timestamp: new Date().toISOString() | |
| }; | |
| console.log('Order confirmed:', order); // For demo purposes | |
| // Show confirmation modal | |
| setIsModalOpen(true); | |
| // Clear cart and phone number | |
| setCartItems([]); | |
| setBizumPhone(''); | |
| // Close cart | |
| setIsCartOpen(false); | |
| }; | |
| return ( | |
| <div className="min-h-screen"> | |
| <Header cartCount={cartCount} onCartClick={() => setIsCartOpen(true)} /> | |
| <HeroSection /> | |
| <Categories onCategorySelect={filterDishes} /> | |
| <DishesSection dishes={dishes} onAddToCart={addToCart} /> | |
| <CartSidebar | |
| isOpen={isCartOpen} | |
| onClose={() => setIsCartOpen(false)} | |
| cartItems={cartItems} | |
| subtotal={subtotal} | |
| total={total} | |
| onUpdateQuantity={updateQuantity} | |
| onRemoveItem={removeFromCart} | |
| onCheckout={handleCheckout} | |
| bizumPhone={bizumPhone} | |
| onBizumPhoneChange={setBizumPhone} | |
| isCheckoutDisabled={isCheckoutDisabled} | |
| /> | |
| <ConfirmationModal | |
| isOpen={isModalOpen} | |
| onClose={() => setIsModalOpen(false)} | |
| /> | |
| </div> | |
| ); | |
| } | |
| // Render the app | |
| const root = ReactDOM.createRoot(document.getElementById('root')); | |
| root.render(<App />); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Alejo3007/website" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |