-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
356 lines (324 loc) · 10 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Random Main Course Recipes</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #f0f0f0;
margin: 0;
padding: 70px 20px 20px;
display: flex;
flex-direction: column;
align-items: center;
}
.blockedScroll{
overflow-y:hidden;
}
.banner {
position: fixed;
top: 0;
left: 0;
width: 100%;
background-color: #3498db;
color: white;
padding: 10px 20px;
display: flex;
justify-content: space-between;
align-items: center;
z-index: 1000;
box-sizing: border-box;
}
.banner a {
color: white;
text-decoration: none;
font-weight: bold;
}
h1 {
color: #333;
margin-bottom: 20px;
}
#recipesContainer, #selectionOfWeekContainer {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 20px;
width: 100%;
max-width: 1200px;
}
.recipe {
background-color: #fff;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
overflow: hidden;
transition: transform 0.3s ease;
position: relative;
}
.recipe:hover {
transform: translateY(-5px);
}
.recipe img {
width: 100%;
height: 40%;
object-fit: cover;
}
.recipe-info {
padding: 15px;
}
.recipe h2 {
margin: 0 0 10px;
font-size: 1.2em;
color: #333;
}
.recipe p {
margin: 0 0 10px;
color: #666;
}
.recipe a, .view-ingredients {
display: inline-block;
background-color: #3498db;
color: white;
text-decoration: none;
padding: 8px 12px;
border-radius: 4px;
transition: background-color 0.3s ease;
margin-right: 10px;
margin-bottom: 10px;
border: none;
cursor: pointer;
font-size: 14px;
}
.recipe a:hover, .view-ingredients:hover {
background-color: #2980b9;
}
.favorite-icon {
position: absolute;
top: 10px;
right: 10px;
font-size: 24px;
color: #fff;
cursor: pointer;
text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}
.favorite-icon.active {
color: #e74c3c;
}
.list-icon {
position: absolute;
top: 10px;
left: 10px;
font-size: 24px;
color: #fff;
cursor: pointer;
text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
z-index: 10; /* Ensure the icon is above the image */
}
.list-icon.active {
color: #2ecc71;
}
#newRecipesButton {
margin-top: 20px;
padding: 10px 20px;
font-size: 1em;
background-color: #2ecc71;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.3s ease;
}
#newRecipesButton:hover {
background-color: #27ae60;
}
#newRecipesButton1 {
margin-top: 1rem;
margin-bottom: 1rem;
padding: 10px 20px;
font-size: 1em;
background-color: #2ecc71;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.3s ease;
}
#newRecipesButton1:hover {
background-color: #27ae60;
}
#showsumIngredientsButton {
margin-top: 20px;
padding: 10px 20px;
font-size: 1em;
background-color: #2ecc71;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.3s ease;
}
#showsumIngredientsButton:hover {
background-color: #27ae60;
}
#copytoclipboardButton {
margin-top: 20px;
padding: 10px 20px;
font-size: 1em;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.3s ease;
}
#copytoclipboardButton:hover {
background-color: #c1c1c1;
}
.modal {
display: none;
position: fixed;
z-index: 1001;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0,0,0,0.4);
}
.modal-content {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 500px;
border-radius: 8px;
}
.close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
cursor: pointer;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
#selectionOfWeekContainer {
display: none;
margin-top: 20px;
}
#selectionOfWeekContainer h2 {
color: #333;
margin-bottom: 20px;
grid-column: 1 / -1;
}
/* Style of Side nav*/
.menu-toggle {
font-size: 24px;
cursor: pointer;
z-index: 1000;
color: #7EBDC3;
}
.sidebar {
position: fixed;
top: 0;
left: -250px; /* makes the sidebar hidden because at -250pixels o nthe left and the sidebar is 250pixel width so becomes hidden*/
width: 250px;
height: 100%;
background: #333;
transition: left 0.3s ease;
z-index: 500;
}
.sidebar ul {
position: absolute;
padding-top: 4rem;
padding-left: 0;
list-style: none;
margin: 0;
}
.sidebar ul li {
padding: 20px;
border-bottom: 1px solid #444;
}
.sidebar ul li a {
color: #fff;
text-decoration: none;
font-size: 18px;
display: flex;
align-items: center;
}
.sidebar ul li a i {
margin-right: 10px;
}
.sidebar.open { /* if element with class .sidebar.open it will make the element left to be set at 0 o nthe screen so it will show the sidebar*/
left: 0;
}
.hr_solid {
border: 0;
clear:both;
display:block;
width: 96%;
background-color:#555555;
height: 0.1rem;
}
.filterDivClass{
display: flex;
flex-direction: row;
align-items: center;
gap:0.5rem;/* allows to have a gap between items of this flex container */
}
</style>
</head>
<body>
<div class="banner">
<div class="menu-toggle">
<i class="fas fa-bars" id="menu-icon"></i>
</div>
<nav class="sidebar">
<ul>
<li><a href="#"><i class="fa-solid fa-house"></i> Home</a></li>
<li><a href="#" id="allRecipesRandomPageBtn"><i class="fas fa-check-double" id="filter-icon"></i> Filter recipes</a></li>
<li><a href="#" onclick="saveData()"><i class="fas fa-file-download" id="save-icon" onclick="saveData()"></i> Save data</a></li>
<li><a href="#" onclick="loadData()"><i class="fas fa-file-upload" id="load-icon" onclick="loadData()"></i> Load data</a></li>
<li><a href="#"><i class="fas fa-info"></i> About</a></li>
</ul>
</nav>
<a href="index.html" id="shuffler">Shuffler</a>
<a href="#" id="favorites">Favorites</a>
<a href="#" id="selectionOfWeek">Selection of the week</a>
</div>
<h1>Random Main Course Recipes</h1>
<div id="filterDiv" class="filterDivClass"></div>
<hr class="hr_solid">
<button id="newRecipesButton1">Show New Recipes</button>
<div id="recipesContainer"></div>
<div id="selectionOfWeekContainer"></div>
<hr class="hr_solid">
<button id="newRecipesButton">Show New Recipes</button>
<button id="showsumIngredientsButton">Show all Ingredients for the week selection</button>
<div id="ingredientsModal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<h2 id="modalTitle"></h2>
<h2 id="modalrecipeName"></h2>
<p id="servingDefault"></p>
<ul id="ingredientsList"></ul>
<button id="copytoclipboardButton">
<i class="fas fa-clipboard"></i> Copy list to clipboard
</button>
</div>
</div>
<!-- Dialog structure -->
<div id="sumingredientsModal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<h2 id="sumingredientsTitle"></h2>
<ul id="sumingredientsList"></ul>
<!--<button id="closeDialogBtn">Close</button>-->
</div>
</div>
<script src="app.js"></script>
</body>
</html>