File size: 5,675 Bytes
971e00f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dynamic Menu</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            background: #f8f9fa;
            text-align: center;
        }
        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: #ff6b00;
            padding: 15px;
            color: white;
        }
        .search-bar {
            flex-grow: 1;
            margin: 0 10px;
        }
        .search-bar input {
            width: 70%;
            padding: 8px;
            border-radius: 5px;
            border: none;
        }
        .avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: white;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            position: relative;
        }
        .avatar-menu {
            display: none;
            position: absolute;
            top: 50px;
            right: 0;
            background: white;
            color: black;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
            border-radius: 5px;
            width: 150px;
            text-align: left;
        }
        .avatar-menu a {
            display: block;
            padding: 10px;
            text-decoration: none;
            color: black;
        }
        .avatar-menu a:hover {
            background: #f0f0f0;
        }
        .avatar:hover .avatar-menu {
            display: block;
        }
        .container {
            max-width: 800px;
            margin: auto;
            background: white;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
            margin-top: 20px;
        }
        .menu-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            border-bottom: 1px solid #ddd;
            padding: 15px;
        }
        .menu-item img {
            width: 100px;
            height: 100px;
            border-radius: 10px;
            margin-top: 10px;
        }
        .menu-details {
            padding: 10px;
            text-align: center;
        }
        .menu-details h3 {
            margin: 0;
            font-size: 18px;
        }
        .menu-details p {
            margin: 5px 0;
            color: #666;
        }
        .add-btn {
            background: #28a745;
            color: white;
            border: none;
            padding: 10px 20px;
            cursor: pointer;
            border-radius: 5px;
            font-weight: bold;
            transition: background 0.3s;
        }
        .add-btn:hover {
            background: #218838;
        }
        .cart-btn {
            background: #28a745;
            color: white;
            border: none;
            padding: 10px;
            cursor: pointer;
            border-radius: 5px;
            font-weight: bold;
            margin-top: 20px;
            width: auto;
            display: block;
        }
        .cart-btn:hover {
            background: #218838;
        }
    </style>
</head>
<body>
    <div class="header">
        <div class="search-bar">
            <input type="text" id="search" placeholder="Search food items..." onkeyup="searchMenu()">
        </div>
        <div class="avatar">👤
            <div class="avatar-menu">
                <a href="#">Profile</a>
                <a href="#">Rewards</a>
                <a href="#">My Orders</a>
                <a href="#" onclick="logout()">Logout</a>
            </div>
        </div>
    </div>
    
    <div class="container">
        <h2>Food Menu</h2>
        <div id="menu"></div>
        <button class="cart-btn">View Cart</button>
    </div>

    <script>
        const menuItems = [
            { name: "Margherita Pizza", price: "₹299", image: "pizza.jpg", description: "Classic Margherita with fresh basil and mozzarella." },
            { name: "Veg Burger", price: "₹149", image: "burger.jpg", description: "Crispy veggie patty with fresh lettuce and tomato." },
            { name: "Pasta Alfredo", price: "₹249", image: "pasta.jpg", description: "Creamy Alfredo sauce with penne pasta." },
            { name: "French Fries", price: "₹99", image: "fries.jpg", description: "Crispy golden French fries with ketchup." },
            { name: "Cold Coffee", price: "₹129", image: "coffee.jpg", description: "Chilled coffee with creamy froth." }
        ];

        function loadMenu() {
            const menuContainer = document.getElementById("menu");
            menuContainer.innerHTML = "";
            menuItems.forEach(item => {
                const menuItem = document.createElement("div");
                menuItem.classList.add("menu-item");
                menuItem.innerHTML = `
                    <button class="add-btn">ADD</button>
                    <div class="menu-details">
                        <h3>${item.name}</h3>
                        <p>${item.price}</p>
                        <p>${item.description}</p>
                    </div>
                    <img src="${item.image}" alt="${item.name}">
                `;
                menuContainer.appendChild(menuItem);
            });
        }

        function logout() {
            alert("Logged out successfully!");
        }

        document.addEventListener("DOMContentLoaded", loadMenu);
    </script>
</body>
</html>