File size: 28,039 Bytes
2a84054 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FoodDash - Food Delivery App</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">
<style>
/* Custom scrollbar */
.custom-scroll::-webkit-scrollbar {
width: 6px;
height: 6px;
}
.custom-scroll::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 10px;
}
.custom-scroll::-webkit-scrollbar-thumb {
background: #888;
border-radius: 10px;
}
.custom-scroll::-webkit-scrollbar-thumb:hover {
background: #555;
}
/* Animation for food items */
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.animate-fadeIn {
animation: fadeIn 0.3s ease-out forwards;
}
/* Custom checkbox for dietary preferences */
.diet-checkbox:checked + .diet-label {
background-color: #f59e0b;
color: white;
}
/* Pulse animation for cart button */
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.1); }
100% { transform: scale(1); }
}
.pulse {
animation: pulse 1.5s infinite;
}
</style>
</head>
<body class="bg-gray-50 font-sans">
<!-- App Container -->
<div class="max-w-md mx-auto bg-white shadow-lg rounded-lg overflow-hidden relative" style="height: 100vh; max-height: 800px;">
<!-- Header -->
<div class="bg-orange-500 p-4 flex justify-between items-center">
<div class="flex items-center space-x-2">
<i class="fas fa-map-marker-alt text-white"></i>
<div>
<p class="text-xs text-white">Delivery to</p>
<p class="text-white font-medium">Home • 15-20 min</p>
</div>
</div>
<div class="relative">
<button id="cartBtn" class="bg-white text-orange-500 p-2 rounded-full relative">
<i class="fas fa-shopping-basket"></i>
<span id="cartCount" class="absolute -top-1 -right-1 bg-red-500 text-white text-xs rounded-full h-5 w-5 flex items-center justify-center">0</span>
</button>
</div>
</div>
<!-- Search Bar -->
<div class="p-4">
<div class="relative">
<input type="text" placeholder="Search for restaurants or dishes..." class="w-full bg-gray-100 rounded-full py-2 px-4 pl-10 focus:outline-none focus:ring-2 focus:ring-orange-300">
<i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
</div>
</div>
<!-- Categories -->
<div class="px-4 pb-2 overflow-x-auto custom-scroll">
<div class="flex space-x-3">
<button class="category-btn bg-orange-500 text-white px-4 py-1 rounded-full text-sm whitespace-nowrap">All</button>
<button class="category-btn bg-gray-100 text-gray-700 px-4 py-1 rounded-full text-sm whitespace-nowrap">Burger</button>
<button class="category-btn bg-gray-100 text-gray-700 px-4 py-1 rounded-full text-sm whitespace-nowrap">Pizza</button>
<button class="category-btn bg-gray-100 text-gray-700 px-4 py-1 rounded-full text-sm whitespace-nowrap">Sushi</button>
<button class="category-btn bg-gray-100 text-gray-700 px-4 py-1 rounded-full text-sm whitespace-nowrap">Salad</button>
<button class="category-btn bg-gray-100 text-gray-700 px-4 py-1 rounded-full text-sm whitespace-nowrap">Dessert</button>
</div>
</div>
<!-- Featured Banner -->
<div class="mx-4 my-2 bg-gradient-to-r from-orange-400 to-orange-600 rounded-xl p-4 text-white relative overflow-hidden">
<div class="relative z-10">
<h3 class="font-bold text-lg">Special Offer!</h3>
<p class="text-sm">Get 20% off on your first order</p>
<button class="mt-2 bg-white text-orange-500 text-xs px-3 py-1 rounded-full">Order Now</button>
</div>
<div class="absolute right-0 bottom-0 opacity-20">
<i class="fas fa-utensils text-6xl"></i>
</div>
</div>
<!-- Restaurants/Food Items -->
<div class="px-4 py-2 overflow-y-auto custom-scroll" style="height: calc(100% - 240px);">
<h3 class="font-bold text-lg mb-3">Popular Near You</h3>
<!-- Restaurant/Food Item Cards -->
<div class="grid grid-cols-2 gap-3" id="foodItems">
<!-- Items will be added dynamically -->
</div>
</div>
<!-- Bottom Navigation -->
<div class="absolute bottom-0 left-0 right-0 bg-white border-t border-gray-200 flex justify-around py-2">
<button class="text-orange-500 flex flex-col items-center">
<i class="fas fa-home"></i>
<span class="text-xs">Home</span>
</button>
<button class="text-gray-500 flex flex-col items-center">
<i class="fas fa-search"></i>
<span class="text-xs">Search</span>
</button>
<button class="text-gray-500 flex flex-col items-center">
<i class="fas fa-heart"></i>
<span class="text-xs">Favorites</span>
</button>
<button class="text-gray-500 flex flex-col items-center">
<i class="fas fa-user"></i>
<span class="text-xs">Profile</span>
</button>
</div>
<!-- Cart Modal -->
<div id="cartModal" class="hidden fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
<div class="bg-white rounded-t-xl w-full max-w-md absolute bottom-0 max-h-[80vh] overflow-hidden">
<div class="p-4 border-b border-gray-200 flex justify-between items-center">
<h3 class="font-bold text-lg">Your Order</h3>
<button id="closeCart" class="text-gray-500">
<i class="fas fa-times"></i>
</button>
</div>
<div class="overflow-y-auto custom-scroll" style="max-height: 60vh;">
<div id="cartItems" class="divide-y divide-gray-200">
<!-- Cart items will be added here -->
<div class="p-4 text-center text-gray-500">
<i class="fas fa-shopping-basket text-4xl mb-2 opacity-30"></i>
<p>Your cart is empty</p>
</div>
</div>
</div>
<div class="p-4 border-t border-gray-200 bg-white">
<div class="flex justify-between mb-2">
<span>Subtotal</span>
<span id="subtotal">$0.00</span>
</div>
<div class="flex justify-between mb-2">
<span>Delivery Fee</span>
<span>$2.99</span>
</div>
<div class="flex justify-between font-bold text-lg">
<span>Total</span>
<span id="total">$2.99</span>
</div>
<button id="checkoutBtn" class="w-full bg-orange-500 text-white py-3 rounded-lg mt-3 disabled:opacity-50" disabled>
Checkout
</button>
</div>
</div>
</div>
<!-- Food Detail Modal -->
<div id="foodDetailModal" class="hidden fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
<div class="bg-white rounded-xl w-full max-w-md mx-4 max-h-[80vh] overflow-hidden">
<div class="relative">
<img id="detailImage" src="https://via.placeholder.com/400x200" alt="Food" class="w-full h-48 object-cover">
<button id="closeDetail" class="absolute top-2 right-2 bg-white text-gray-800 p-2 rounded-full shadow">
<i class="fas fa-times"></i>
</button>
</div>
<div class="p-4 overflow-y-auto custom-scroll" style="max-height: calc(80vh - 200px);">
<div class="flex justify-between items-start">
<div>
<h3 id="detailName" class="font-bold text-xl">Food Name</h3>
<p id="detailDescription" class="text-gray-600 text-sm mt-1">Description goes here</p>
</div>
<span id="detailPrice" class="font-bold text-orange-500">$12.99</span>
</div>
<div class="mt-4">
<h4 class="font-medium mb-2">Dietary Preferences</h4>
<div class="flex flex-wrap gap-2">
<div>
<input type="checkbox" id="vegetarian" class="diet-checkbox hidden">
<label for="vegetarian" class="diet-label bg-gray-100 text-gray-700 px-3 py-1 rounded-full text-xs flex items-center">
<i class="fas fa-leaf mr-1"></i> Vegetarian
</label>
</div>
<div>
<input type="checkbox" id="vegan" class="diet-checkbox hidden">
<label for="vegan" class="diet-label bg-gray-100 text-gray-700 px-3 py-1 rounded-full text-xs flex items-center">
<i class="fas fa-seedling mr-1"></i> Vegan
</label>
</div>
<div>
<input type="checkbox" id="glutenFree" class="diet-checkbox hidden">
<label for="glutenFree" class="diet-label bg-gray-100 text-gray-700 px-3 py-1 rounded-full text-xs flex items-center">
<i class="fas fa-bread-slice mr-1"></i> Gluten Free
</label>
</div>
</div>
</div>
<div class="mt-4">
<h4 class="font-medium mb-2">Special Instructions</h4>
<textarea placeholder="Any special requests?" class="w-full border border-gray-300 rounded-lg p-2 text-sm focus:outline-none focus:ring-1 focus:ring-orange-300"></textarea>
</div>
<div class="mt-4 flex items-center justify-between">
<div class="flex items-center border border-gray-300 rounded-lg">
<button id="decreaseQty" class="px-3 py-1 text-gray-600">
<i class="fas fa-minus"></i>
</button>
<span id="quantity" class="px-3">1</span>
<button id="increaseQty" class="px-3 py-1 text-gray-600">
<i class="fas fa-plus"></i>
</button>
</div>
<button id="addToCart" class="bg-orange-500 text-white px-4 py-2 rounded-lg">
Add to Cart - <span id="totalPrice">$12.99</span>
</button>
</div>
</div>
</div>
</div>
</div>
<script>
// Sample food data
const foodItems = [
{
id: 1,
name: "Classic Burger",
description: "Beef patty with cheese, lettuce, and special sauce",
price: 8.99,
image: "https://images.unsplash.com/photo-1568901346375-23c9450c58cd?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8YnVyZ2VyfGVufDB8fDB8fHww&auto=format&fit=crop&w=500&q=60"
},
{
id: 2,
name: "Pepperoni Pizza",
description: "Classic pizza with mozzarella and pepperoni",
price: 12.99,
image: "https://images.unsplash.com/photo-1628840042765-356cda07504e?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8cGVwcGVyb25pJTIwcGl6emF8ZW58MHx8MHx8fDA%3D&auto=format&fit=crop&w=500&q=60"
},
{
id: 3,
name: "California Roll",
description: "Crab, avocado and cucumber sushi roll",
price: 10.50,
image: "https://images.unsplash.com/photo-1617196035154-1ed7f6ac3f91?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8c3VzaGl8ZW58MHx8MHx8fDA%3D&auto=format&fit=crop&w=500&q=60"
},
{
id: 4,
name: "Caesar Salad",
description: "Romaine lettuce, croutons, parmesan with Caesar dressing",
price: 7.99,
image: "https://images.unsplash.com/photo-1546793665-c74683f339c1?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8NHx8c2FsYWR8ZW58MHx8MHx8fDA%3D&auto=format&fit=crop&w=500&q=60"
},
{
id: 5,
name: "Chocolate Brownie",
description: "Warm chocolate brownie with vanilla ice cream",
price: 5.99,
image: "https://images.unsplash.com/photo-1564355808539-22fda35bed7e?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8N3x8ZGVzc2VydHxlbnwwfHwwfHx8MA%3D%3D&auto=format&fit=crop&w=500&q=60"
},
{
id: 6,
name: "Chicken Wings",
description: "Crispy fried wings with your choice of sauce",
price: 9.99,
image: "https://images.unsplash.com/photo-1567620832903-9fc6e53a2ead?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8NXx8Y2hpY2tlbiUyMHdpbmdzfGVufDB8fDB8fHww&auto=format&fit=crop&w=500&q=60"
}
];
// Cart state
let cart = [];
let currentFoodItem = null;
let quantity = 1;
// DOM elements
const foodItemsContainer = document.getElementById('foodItems');
const cartModal = document.getElementById('cartModal');
const cartBtn = document.getElementById('cartBtn');
const closeCart = document.getElementById('closeCart');
const cartItems = document.getElementById('cartItems');
const cartCount = document.getElementById('cartCount');
const subtotal = document.getElementById('subtotal');
const total = document.getElementById('total');
const checkoutBtn = document.getElementById('checkoutBtn');
const foodDetailModal = document.getElementById('foodDetailModal');
const closeDetail = document.getElementById('closeDetail');
const detailName = document.getElementById('detailName');
const detailDescription = document.getElementById('detailDescription');
const detailPrice = document.getElementById('detailPrice');
const detailImage = document.getElementById('detailImage');
const quantityElement = document.getElementById('quantity');
const totalPrice = document.getElementById('totalPrice');
const increaseQty = document.getElementById('increaseQty');
const decreaseQty = document.getElementById('decreaseQty');
const addToCart = document.getElementById('addToCart');
// Initialize the app
function init() {
renderFoodItems();
setupEventListeners();
}
// Render food items
function renderFoodItems() {
foodItemsContainer.innerHTML = '';
foodItems.forEach((item, index) => {
const foodItem = document.createElement('div');
foodItem.className = 'bg-white rounded-lg overflow-hidden shadow-sm border border-gray-100 animate-fadeIn';
foodItem.style.animationDelay = `${index * 0.05}s`;
foodItem.innerHTML = `
<div class="relative">
<img src="${item.image}" alt="${item.name}" class="w-full h-32 object-cover">
<button class="absolute top-2 right-2 bg-white text-orange-500 p-1 rounded-full shadow food-detail-btn" data-id="${item.id}">
<i class="fas fa-plus text-xs"></i>
</button>
</div>
<div class="p-3">
<h4 class="font-medium">${item.name}</h4>
<p class="text-gray-500 text-xs mt-1 truncate">${item.description}</p>
<div class="flex justify-between items-center mt-2">
<span class="font-bold text-orange-500">$${item.price.toFixed(2)}</span>
<span class="text-yellow-500 text-xs">
<i class="fas fa-star"></i> 4.5
</span>
</div>
</div>
`;
foodItemsContainer.appendChild(foodItem);
});
}
// Setup event listeners
function setupEventListeners() {
// Cart modal
cartBtn.addEventListener('click', () => {
cartModal.classList.remove('hidden');
renderCartItems();
});
closeCart.addEventListener('click', () => {
cartModal.classList.add('hidden');
});
// Food detail modal
document.querySelectorAll('.food-detail-btn').forEach(btn => {
btn.addEventListener('click', (e) => {
const id = parseInt(e.currentTarget.getAttribute('data-id'));
showFoodDetail(id);
});
});
closeDetail.addEventListener('click', () => {
foodDetailModal.classList.add('hidden');
});
// Quantity controls
increaseQty.addEventListener('click', () => {
quantity++;
updateQuantity();
});
decreaseQty.addEventListener('click', () => {
if (quantity > 1) {
quantity--;
updateQuantity();
}
});
// Add to cart
addToCart.addEventListener('click', () => {
if (currentFoodItem) {
addItemToCart(currentFoodItem, quantity);
foodDetailModal.classList.add('hidden');
quantity = 1;
updateCartCount();
// Add pulse animation to cart button
cartBtn.classList.add('pulse');
setTimeout(() => {
cartBtn.classList.remove('pulse');
}, 3000);
}
});
// Category buttons
document.querySelectorAll('.category-btn').forEach(btn => {
btn.addEventListener('click', (e) => {
document.querySelectorAll('.category-btn').forEach(b => {
b.classList.remove('bg-orange-500', 'text-white');
b.classList.add('bg-gray-100', 'text-gray-700');
});
e.currentTarget.classList.remove('bg-gray-100', 'text-gray-700');
e.currentTarget.classList.add('bg-orange-500', 'text-white');
// In a real app, we would filter items here
});
});
// Checkout button
checkoutBtn.addEventListener('click', () => {
alert('Order placed successfully!');
cart = [];
updateCartCount();
renderCartItems();
cartModal.classList.add('hidden');
});
}
// Show food detail modal
function showFoodDetail(id) {
currentFoodItem = foodItems.find(item => item.id === id);
if (currentFoodItem) {
detailName.textContent = currentFoodItem.name;
detailDescription.textContent = currentFoodItem.description;
detailPrice.textContent = `$${currentFoodItem.price.toFixed(2)}`;
detailImage.src = currentFoodItem.image;
quantityElement.textContent = '1';
totalPrice.textContent = `$${currentFoodItem.price.toFixed(2)}`;
foodDetailModal.classList.remove('hidden');
}
}
// Update quantity display
function updateQuantity() {
quantityElement.textContent = quantity;
if (currentFoodItem) {
const total = (currentFoodItem.price * quantity).toFixed(2);
totalPrice.textContent = `$${total}`;
}
}
// Add item to cart
function addItemToCart(item, qty) {
const existingItem = cart.find(cartItem => cartItem.id === item.id);
if (existingItem) {
existingItem.quantity += qty;
} else {
cart.push({
...item,
quantity: qty
});
}
updateCartCount();
renderCartItems();
}
// Update cart count
function updateCartCount() {
const count = cart.reduce((total, item) => total + item.quantity, 0);
cartCount.textContent = count;
if (count > 0) {
cartCount.classList.remove('hidden');
checkoutBtn.disabled = false;
} else {
cartCount.classList.add('hidden');
checkoutBtn.disabled = true;
}
}
// Render cart items
function renderCartItems() {
if (cart.length === 0) {
cartItems.innerHTML = `
<div class="p-4 text-center text-gray-500">
<i class="fas fa-shopping-basket text-4xl mb-2 opacity-30"></i>
<p>Your cart is empty</p>
</div>
`;
subtotal.textContent = '$0.00';
total.textContent = '$2.99';
return;
}
cartItems.innerHTML = '';
let subtotalAmount = 0;
cart.forEach(item => {
const itemTotal = item.price * item.quantity;
subtotalAmount += itemTotal;
const cartItem = document.createElement('div');
cartItem.className = 'p-4 flex items-center';
cartItem.innerHTML = `
<div class="flex-shrink-0 w-16 h-16 bg-gray-100 rounded-lg overflow-hidden">
<img src="${item.image}" alt="${item.name}" class="w-full h-full object-cover">
</div>
<div class="ml-3 flex-grow">
<h4 class="font-medium">${item.name}</h4>
<div class="flex justify-between items-center mt-1">
<span class="text-orange-500 font-medium">$${item.price.toFixed(2)}</span>
<div class="flex items-center">
<button class="decrease-item px-2 text-gray-500" data-id="${item.id}">
<i class="fas fa-minus text-xs"></i>
</button>
<span class="mx-2">${item.quantity}</span>
<button class="increase-item px-2 text-gray-500" data-id="${item.id}">
<i class="fas fa-plus text-xs"></i>
</button>
</div>
</div>
</div>
<button class="remove-item ml-2 text-red-500" data-id="${item.id}">
<i class="fas fa-trash"></i>
</button>
`;
cartItems.appendChild(cartItem);
});
// Add event listeners for cart item controls
document.querySelectorAll('.increase-item').forEach(btn => {
btn.addEventListener('click', (e) => {
const id = parseInt(e.currentTarget.getAttribute('data-id'));
const item = cart.find(item => item.id === id);
if (item) {
item.quantity++;
updateCartCount();
renderCartItems();
}
});
});
document.querySelectorAll('.decrease-item').forEach(btn => {
btn.addEventListener('click', (e) => {
const id = parseInt(e.currentTarget.getAttribute('data-id'));
const itemIndex = cart.findIndex(item => item.id === id);
if (itemIndex !== -1) {
if (cart[itemIndex].quantity > 1) {
cart[itemIndex].quantity--;
} else {
cart.splice(itemIndex, 1);
}
updateCartCount();
renderCartItems();
}
});
});
document.querySelectorAll('.remove-item').forEach(btn => {
btn.addEventListener('click', (e) => {
const id = parseInt(e.currentTarget.getAttribute('data-id'));
const itemIndex = cart.findIndex(item => item.id === id);
if (itemIndex !== -1) {
cart.splice(itemIndex, 1);
updateCartCount();
renderCartItems();
}
});
});
// Update totals
const deliveryFee = 2.99;
const totalAmount = subtotalAmount + deliveryFee;
subtotal.textContent = `$${subtotalAmount.toFixed(2)}`;
total.textContent = `$${totalAmount.toFixed(2)}`;
}
// Initialize the app
document.addEventListener('DOMContentLoaded', init);
</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=chimpuuuu/hhh" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |