File size: 1,484 Bytes
1872519
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
// Shared JavaScript across all pages
document.addEventListener('DOMContentLoaded', function() {
    console.log('Lemon Drop App loaded');
    
    // Add to cart functionality
    const addToCartButtons = document.querySelectorAll('.add-to-cart-btn');
    addToCartButtons.forEach(button => {
        button.addEventListener('click', function() {
            const productId = this.dataset.productId;
            const productName = this.dataset.productName;
            
            // In a real app, this would add to cart
            console.log(`Added ${productName} (${productId}) to cart`);
            
            // Show confirmation
            const originalText = this.innerHTML;
            this.innerHTML = '<i data-feather="check"></i> Added!';
            this.classList.remove('bg-emerald-500');
            this.classList.add('bg-green-500');
            
            setTimeout(() => {
                this.innerHTML = originalText;
                this.classList.remove('bg-green-500');
                this.classList.add('bg-emerald-500');
                feather.replace();
            }, 2000);
        });
    });
    
    // Weight selector
    const weightButtons = document.querySelectorAll('[data-weight]');
    weightButtons.forEach(button => {
        button.addEventListener('click', function() {
            weightButtons.forEach(btn => btn.classList.remove('bg-emerald-500'));
            this.classList.add('bg-emerald-500');
        });
    });
});