deepsite-project-u83dz / products.html
codebyjerry's picture
Initial DeepSite commit
5a4691d verified
Raw History Blame Contribute Delete
15 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>All Products | LUMINA Store</title>
<meta name="description" content="Browse our complete collection of creative fashion, merchandise, and accessories.">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/lucide@latest"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@500;700&display=swap" rel="stylesheet">
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: { 500: '#f97316', 600: '#ea580c', 50: '#fff7ed' },
creative: { 500: '#0ea5e9', 600: '#0284c7' }
},
fontFamily: {
sans: ['Inter', 'sans-serif'],
display: ['Space Grotesk', 'sans-serif'],
}
}
}
}
</script>
<style>
.glass-nav {
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(20px);
}
.category-pill.active {
background: #f97316;
color: white;
border-color: #f97316;
}
.product-card { transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.product-card:hover { transform: translateY(-8px); box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15); }
.filter-sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
.filter-sidebar.open { transform: translateX(0); }
.backdrop { opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.backdrop.open { opacity: 1; pointer-events: all; }
@media (min-width: 1024px) {
.filter-sidebar { transform: none; position: static; }
.backdrop { display: none; }
}
.loader {
border: 3px solid #f3f3f3;
border-top: 3px solid #f97316;
border-radius: 50%;
width: 24px;
height: 24px;
animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
</style>
</head>
<body class="bg-gray-50 text-gray-900">
<!-- Navigation -->
<nav class="fixed w-full z-50 glass-nav border-b border-gray-100">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex items-center justify-between h-16">
<a href="index.html" class="flex items-center gap-2">
<div class="w-10 h-10 bg-gradient-to-br from-primary-500 to-creative-500 rounded-xl flex items-center justify-center">
<i data-lucide="sparkles" class="w-6 h-6 text-white"></i>
</div>
<span class="font-display text-2xl font-bold">LUMINA</span>
</a>
<div class="flex items-center gap-4">
<button onclick="toggleFilter()" class="lg:hidden p-2 hover:bg-gray-100 rounded-lg">
<i data-lucide="filter" class="w-5 h-5 text-gray-600"></i>
</button>
<a href="cart.html" class="relative p-2 hover:bg-gray-100 rounded-lg">
<i data-lucide="shopping-bag" class="w-5 h-5 text-gray-600"></i>
<span id="cartBadge" class="absolute -top-1 -right-1 w-5 h-5 bg-primary-500 text-white text-xs font-bold rounded-full flex items-center justify-center opacity-0 transition-opacity">0</span>
</a>
</div>
</div>
</div>
</nav>
<!-- Mobile Filter Backdrop -->
<div id="backdrop" class="backdrop fixed inset-0 bg-black/50 z-40 lg:hidden" onclick="toggleFilter()"></div>
<div class="pt-20 min-h-screen flex">
<!-- Filter Sidebar -->
<aside id="filterSidebar" class="filter-sidebar fixed lg:static top-0 left-0 h-full w-72 bg-white border-r border-gray-200 z-50 p-6 overflow-y-auto">
<div class="flex items-center justify-between mb-6 lg:hidden">
<h2 class="font-display text-xl font-bold">Filters</h2>
<button onclick="toggleFilter()" class="p-2 hover:bg-gray-100 rounded-lg">
<i data-lucide="x" class="w-6 h-6"></i>
</button>
</div>
<!-- Categories -->
<div class="mb-8">
<h3 class="font-semibold mb-4">Categories</h3>
<div class="space-y-2">
<button onclick="filterCategory('all')" class="category-pill w-full text-left px-4 py-2 rounded-lg border border-gray-200 hover:border-primary-500 hover:text-primary-600 transition-colors active" data-category="all">
All Products
</button>
<button onclick="filterCategory('clothing')" class="category-pill w-full text-left px-4 py-2 rounded-lg border border-gray-200 hover:border-primary-500 hover:text-primary-600 transition-colors" data-category="clothing">
Clothing
</button>
<button onclick="filterCategory('merch')" class="category-pill w-full text-left px-4 py-2 rounded-lg border border-gray-200 hover:border-primary-500 hover:text-primary-600 transition-colors" data-category="merch">
Merch
</button>
<button onclick="filterCategory('accessories')" class="category-pill w-full text-left px-4 py-2 rounded-lg border border-gray-200 hover:border-primary-500 hover:text-primary-600 transition-colors" data-category="accessories">
Accessories
</button>
<button onclick="filterCategory('lifestyle')" class="category-pill w-full text-left px-4 py-2 rounded-lg border border-gray-200 hover:border-primary-500 hover:text-primary-600 transition-colors" data-category="lifestyle">
Lifestyle
</button>
</div>
</div>
<!-- Price Range -->
<div class="mb-8">
<h3 class="font-semibold mb-4">Price Range</h3>
<div class="px-2">
<input type="range" id="priceRange" min="0" max="5000" step="100" value="5000" class="w-full accent-primary-500 mb-4" onchange="applyPriceFilter(this.value)">
<div class="flex justify-between text-sm text-gray-600">
<span>₹0</span>
<span id="priceValue">₹5,000</span>
</div>
</div>
</div>
<!-- Sort -->
<div class="mb-8">
<h3 class="font-semibold mb-4">Sort By</h3>
<select id="sortSelect" onchange="sortProducts(this.value)" class="w-full px-4 py-2 border border-gray-200 rounded-lg focus:outline-none focus:border-primary-500">
<option value="featured">Featured</option>
<option value="price-low">Price: Low to High</option>
<option value="price-high">Price: High to Low</option>
<option value="newest">Newest First</option>
</select>
</div>
<button onclick="clearFilters()" class="w-full border border-gray-300 text-gray-600 px-4 py-2 rounded-lg hover:bg-gray-50 transition-colors">
Clear Filters
</button>
</aside>
<!-- Main Content -->
<main class="flex-1 px-4 sm:px-6 lg:px-8 py-8">
<!-- Header -->
<div class="mb-8">
<h1 class="font-display text-3xl font-bold mb-2" id="pageTitle">All Products</h1>
<p class="text-gray-600" id="productCount">Showing all products</p>
</div>
<!-- Active Filters -->
<div id="activeFilters" class="flex flex-wrap gap-2 mb-6 hidden">
<button onclick="clearFilters()" class="text-sm text-gray-600 bg-gray-100 px-3 py-1 rounded-full flex items-center gap-2 hover:bg-gray-200">
Clear all <i data-lucide="x" class="w-3 h-3"></i>
</button>
</div>
<!-- Product Grid -->
<div id="productGrid" class="grid grid-cols-2 md:grid-cols-3 gap-4 sm:gap-6">
<!-- Products loaded by JS -->
</div>
<!-- Empty State -->
<div id="emptyState" class="hidden text-center py-20">
<div class="w-24 h-24 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-4">
<i data-lucide="search" class="w-10 h-10 text-gray-400"></i>
</div>
<h3 class="text-xl font-semibold mb-2">No products found</h3>
<p class="text-gray-600 mb-6">Try adjusting your filters</p>
<button onclick="clearFilters()" class="bg-primary-500 text-white px-6 py-3 rounded-xl font-semibold hover:bg-primary-600 transition-colors">
Clear Filters
</button>
</div>
<!-- Pagination -->
<div class="mt-12 flex justify-center gap-2" id="pagination">
<!-- Pagination by JS -->
</div>
</main>
</div>
<!-- Toast -->
<div id="toast" class="fixed bottom-8 right-8 bg-gray-900 text-white px-6 py-4 rounded-xl shadow-2xl flex items-center gap-3 transform translate-y-20 opacity-0 transition-all duration-300 z-50">
<i data-lucide="check-circle" class="w-5 h-5 text-green-400"></i>
<span id="toastMessage">Added to cart!</span>
</div>
<script src="script.js"></script>
<script>
let currentCategory = 'all';
let currentSort = 'featured';
let maxPrice = 5000;
let currentPage = 1;
const productsPerPage = 9;
document.addEventListener('DOMContentLoaded', () => {
lucide.createIcons();
// Check URL params
const params = new URLSearchParams(window.location.search);
const category = params.get('category');
if (category) {
currentCategory = category;
document.querySelector(`[data-category="${category}"]`)?.classList.add('active');
}
renderProducts();
updateCartBadge();
});
function toggleFilter() {
document.getElementById('filterSidebar').classList.toggle('open');
document.getElementById('backdrop').classList.toggle('open');
}
function filterCategory(category) {
currentCategory = category;
currentPage = 1;
document.querySelectorAll('.category-pill').forEach(btn => {
btn.classList.remove('active');
});
document.querySelector(`[data-category="${category}"]`)?.classList.add('active');
const titles = {
all: 'All Products',
clothing: 'Clothing Collection',
merch: 'Merchandise',
accessories: 'Accessories',
lifestyle: 'Lifestyle'
};
document.getElementById('pageTitle').textContent = titles[category] || 'Products';
renderProducts();
if (window.innerWidth < 1024) {
toggleFilter();
}
}
function applyPriceFilter(value) {
maxPrice = parseInt(value);
document.getElementById('priceValue').textContent = `₹${value.toLocaleString()}`;
currentPage = 1;
renderProducts();
}
function sortProducts(sort) {
currentSort = sort;
renderProducts();
}
function clearFilters() {
currentCategory = 'all';
maxPrice = 5000;
currentSort = 'featured';
currentPage = 1;
document.getElementById('priceRange').value = 5000;
document.getElementById('priceValue').textContent = '₹5,000';
document.getElementById('sortSelect').value = 'featured';
document.querySelectorAll('.category-pill').forEach(btn => btn.classList.remove('active'));
document.querySelector('[data-category="all"]').classList.add('active');
document.getElementById('pageTitle').textContent = 'All Products';
// Update URL
window.history.pushState({}, '', 'products.html');
renderProducts();
}
function renderProducts() {
let filtered = products.filter(p => {
const matchCategory = currentCategory === 'all' || p.category === currentCategory;
const matchPrice = p.price <= maxPrice;
return matchCategory && matchPrice;
});
// Sort
if (currentSort === 'price-low') {
filtered.sort((a, b) => a.price - b.price);
} else if (currentSort === 'price-high') {
filtered.sort((a, b) => b.price - a.price);
} else if (currentSort === 'newest') {
filtered.sort((a, b) => b.id - a.id);
}
const totalPages = Math.ceil(filtered.length / productsPerPage);
const start = (currentPage - 1) * productsPerPage;
const paginated = filtered.slice(start, start + productsPerPage);
const grid = document.getElementById('productGrid');
const emptyState = document.getElementById('emptyState');
const countText = document.getElementById('productCount');
if (filtered.length === 0) {
grid.innerHTML = '';
emptyState.classList.remove('hidden');
countText.textContent = 'No products match your filters';
} else {
emptyState.classList.add('hidden');
countText.textContent = `Showing ${filtered.length} products`;
grid.innerHTML = paginated.map(product => `
<div class="product-card group bg-white rounded-2xl overflow-hidden border border-gray-100">
<a href="product-detail.html?id=${product.id}" class="relative block overflow-hidden aspect-square bg-gray-100">
<img src="${product.image}" alt="${product.name}" class="w-full h-full object-cover transition-transform duration-500 group-hover:scale-110">
${product.badge ? `<span class="absolute top-3 left-3 ${product.badge === 'Sale' ? 'bg-red-500' : 'bg-primary-500'} text-white text-xs font-bold px-3 py-1 rounded-full">${product.badge}</span>` : ''}
</a>
<div class="p-4">
<p class="text-xs text-gray-500 mb-1 capitalize">${product.category}</p>
<h3 class="font-semibold text-gray-900 mb-2 line-clamp-1">${product.name}</h3>
<div class="flex items-center gap-2 mb-3">
<span class="text-lg font-bold text-gray-900">₹${product.price.toLocaleString()}</span>
${product.oldPrice ? `<span class="text-sm text-gray-400 line-through">₹${product.oldPrice.toLocaleString()}</span>` : ''}
</div>
<button onclick="addToCart(${product.id})" class="w-full bg-gray-900 hover:bg-primary-500 text-white py-3 rounded-xl font-semibold transition-colors flex items-center justify-center gap-2">
<i data-lucide="shopping-bag" class="w-4 h-4"></i>
Add to Cart
</button>
</div>
</div>
`).join('');
// Pagination
if (totalPages > 1) {
let paginationHtml = '';
for (let i = 1; i <= totalPages; i++) {
paginationHtml += `
<button onclick="goToPage(${i})" class="w-10 h-10 rounded-lg font-semibold ${currentPage === i ? 'bg-primary-500 text-white' : 'bg-white text-gray-600 border border-gray-200 hover:bg-gray-50'}">
${i}
</button>
`;
}
document.getElementById('pagination').innerHTML = paginationHtml;
} else {
document.getElementById('pagination').innerHTML = '';
}
}
lucide.createIcons();
}
function goToPage(page) {
currentPage = page;
renderProducts();
window.scrollTo({ top: 0, behavior: 'smooth' });
}
</script>
</body>
</html>