-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
531 lines (497 loc) · 34.3 KB
/
index.html
File metadata and controls
531 lines (497 loc) · 34.3 KB
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
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cooking</title>
<link rel="icon" href="./src/images/cookinglogov2.png" type="image/png">
<script src="https://cdnjs.cloudflare.com/ajax/libs/alpinejs/3.12.0/cdn.min.js" defer></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
<style>
[x-cloak] { display: none !important; }
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.fade-in {
animation: fadeIn 0.4s ease-out forwards;
}
@keyframes countUp {
from { transform: translateY(10px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
.count-animation {
animation: countUp 0.5s ease-out forwards;
}
</style>
</head>
<body class="bg-gray-50 font-sans min-h-screen flex flex-col">
<div x-data="recipesApp()" x-cloak class="flex flex-col min-h-screen">
<nav class="bg-white border-b border-gray-100 shadow-sm">
<div class="container mx-auto px-4 py-3">
<div class="flex justify-between items-center">
<div class="flex items-center space-x-4">
<div class="text-red-700">
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253" />
</svg>
</div>
<h1 class="text-2xl font-serif tracking-wide font-medium text-gray-800">Cooking</h1>
<span class="ml-2 bg-red-50 text-red-600 px-2 py-1 rounded-full text-xs font-medium" x-text="recipes.length + ' recettes'"></span>
</div>
<button
@click="mobileMenuOpen = !mobileMenuOpen"
class="md:hidden focus:outline-none"
aria-label="Menu"
>
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-gray-700" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
</svg>
</button>
<div class="hidden md:flex items-center space-x-4">
<div class="relative" @click.away="searchOpen = false">
<div class="relative">
<svg class="absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-500" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-5.2-5.2M17 10a7 7 0 1 1-14 0 7 7 0 0 1 14 0z"/>
</svg>
<input
type="text"
placeholder="Rechercher..."
class="pl-10 pr-3 py-2 rounded-md border border-gray-200 text-sm text-gray-700 focus:outline-none focus:ring-1 focus:ring-red-400 focus:border-red-400 w-64"
x-model="filters.search"
@input="filterRecipes()"
@focus="searchOpen = true"
>
</div>
<div x-show="searchOpen && filters.search.length > 0" class="absolute right-0 mt-2 w-64 bg-white rounded-md shadow-lg z-10 overflow-hidden border border-gray-100">
<div class="py-1 text-sm text-gray-700">
<p class="px-4 py-2 font-medium border-b border-gray-100">Résultats: <span x-text="filteredRecipes.length" class="text-red-500"></span></p>
<template x-for="recipe in filteredRecipes.slice(0, 3)" :key="recipe.id">
<a
href="#"
@click.prevent="openRecipeDetails(recipe)"
class="block px-4 py-2 hover:bg-gray-50"
x-text="recipe.name"
></a>
</template>
<div x-show="filteredRecipes.length > 3" class="border-t border-gray-100 px-4 py-2 text-xs text-gray-500 bg-gray-50">
Et <span x-text="filteredRecipes.length - 3" class="font-medium"></span> autres résultats...
</div>
</div>
</div>
</div>
<div class="relative">
<select
x-model="filters.category"
@change="filterRecipes()"
class="appearance-none w-full px-3 py-2 pr-10 rounded-md border border-gray-200 text-sm text-gray-700 focus:outline-none focus:ring-1 focus:ring-red-400 focus:border-red-400"
>
<option value="">Toutes les catégories</option>
<template x-for="category in categories" :key="category">
<option :value="category" x-text="category"></option>
</template>
</select>
<svg class="absolute right-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-500 pointer-events-none"
xmlns="http://www.w3.org/2000/svg"
fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
</svg>
</div>
</div>
<div
x-show="mobileMenuOpen"
x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0 transform -translate-y-2"
x-transition:enter-end="opacity-100 transform translate-y-0"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100 transform translate-y-0"
x-transition:leave-end="opacity-0 transform -translate-y-2"
class="md:hidden mt-4 pb-2"
>
<div class="space-y-3">
<div class="relative">
<input
type="text"
placeholder="Rechercher..."
class="w-full px-3 py-2 rounded-md border border-gray-200 text-sm text-gray-700 focus:outline-none focus:ring-1 focus:ring-red-400 focus:border-red-400"
x-model="filters.search"
@input="filterRecipes()"
>
</div>
<div>
<select
x-model="filters.category"
@change="filterRecipes()"
class="w-full px-3 py-2 rounded-md border border-gray-200 text-sm text-gray-700 focus:outline-none focus:ring-1 focus:ring-red-400 focus:border-red-400"
>
<option value="">Toutes les catégories</option>
<template x-for="category in categories" :key="category">
<option :value="category" x-text="category"></option>
</template>
</select>
</div>
</div>
</div>
</div>
</nav>
<main class="flex-grow container mx-auto px-4 py-8">
<div x-show="error" class="bg-red-50 border-l-4 border-red-400 text-red-700 p-4 rounded-md mb-6">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd" />
</svg>
</div>
<p class="ml-3 text-sm" x-text="error"></p>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-4 gap-8">
<aside class="lg:col-span-1">
<div class="bg-white rounded-md border border-gray-200 p-5 sticky top-4">
<h2 class="text-lg font-medium text-gray-800 mb-4 flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2 text-red-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z" />
</svg>
Filtres
</h2>
<div class="mb-6">
<h3 class="text-sm font-medium text-gray-700 mb-2 uppercase tracking-wider">Difficulté</h3>
<div class="space-y-2">
<template x-for="level in ['Facile', 'Moyen', 'Difficile']" :key="level">
<div class="flex items-center">
<input
type="checkbox"
:id="'difficulty-' + level.toLowerCase()"
:value="level"
x-model="filters.difficulty"
@change="filterRecipes()"
class="h-4 w-4 text-red-500 focus:ring-red-400 border-gray-300 rounded"
>
<label
:for="'difficulty-' + level.toLowerCase()"
class="ml-2 text-sm"
:class="{
'text-green-600': level === 'Facile',
'text-yellow-500': level === 'Moyen',
'text-red-500': level === 'Difficile'
}"
x-text="level"
></label>
</div>
</template>
</div>
</div>
<div class="mb-6">
<h3 class="text-sm font-medium text-gray-700 mb-2 uppercase tracking-wider">Temps de préparation</h3>
<div class="space-y-2">
<div class="flex items-center">
<input
type="radio"
id="time-all"
value=""
x-model="filters.time"
@change="filterRecipes()"
class="h-4 w-4 text-red-500 focus:ring-red-400 border-gray-300"
>
<label for="time-all" class="ml-2 text-sm text-gray-700">Tous les temps</label>
</div>
<div class="flex items-center">
<input
type="radio"
id="time-15"
value="15"
x-model="filters.time"
@change="filterRecipes()"
class="h-4 w-4 text-red-500 focus:ring-red-400 border-gray-300"
>
<label for="time-15" class="ml-2 text-sm text-gray-700">Moins de 15 min</label>
</div>
<div class="flex items-center">
<input
type="radio"
id="time-30"
value="30"
x-model="filters.time"
@change="filterRecipes()"
class="h-4 w-4 text-red-500 focus:ring-red-400 border-gray-300"
>
<label for="time-30" class="ml-2 text-sm text-gray-700">Moins de 30 min</label>
</div>
<div class="flex items-center">
<input
type="radio"
id="time-60"
value="60"
x-model="filters.time"
@change="filterRecipes()"
class="h-4 w-4 text-red-500 focus:ring-red-400 border-gray-300"
>
<label for="time-60" class="ml-2 text-sm text-gray-700">Moins de 1h</label>
</div>
</div>
</div>
<button
@click="resetFilters()"
class="w-full py-2 bg-red-600 hover:bg-red-700 text-white rounded-md text-sm font-medium transition-colors duration-200 flex items-center justify-center"
>
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
</svg>
Réinitialiser les filtres
</button>
</div>
</aside>
<section class="lg:col-span-3">
<div x-show="loading" class="text-center py-12">
<svg class="animate-spin h-10 w-10 mx-auto text-red-500" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
<p class="text-gray-500 mt-4">Chargement des recettes...</p>
</div>
<div x-show="!loading && filteredRecipes.length === 0" class="text-center py-12 bg-white rounded-md border border-gray-200">
<svg xmlns="http://www.w3.org/2000/svg" class="h-16 w-16 mx-auto text-gray-300 mb-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<p class="text-gray-500 mb-4">Aucune recette ne correspond à vos critères.</p>
<button
@click="resetFilters()"
class="px-4 py-2 bg-red-600 text-white rounded-md hover:bg-red-700 transition-colors duration-200 text-sm font-medium"
>
Réinitialiser les filtres
</button>
</div>
<div
x-show="!loading && filteredRecipes.length > 0"
class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"
>
<template x-for="recipe in filteredRecipes" :key="recipe.id">
<div class="bg-white rounded-md border border-gray-200 overflow-hidden hover:shadow-md transition-shadow duration-200 cursor-pointer">
<div class="relative overflow-hidden">
<div class="w-full h-48 bg-gray-200 relative lazy-image-container" :data-recipe-id="recipe.id">
<img
:src="getImageUrl(recipe)"
:alt="recipe.name"
class="w-full h-full object-cover transition-opacity duration-300"
:class="{'opacity-70': !loadedImages[recipe.id]}"
>
<div
x-show="!loadedImages[recipe.id]"
class="absolute inset-0 flex items-center justify-center bg-black bg-opacity-30"
>
<div class="bg-white bg-opacity-90 text-gray-800 px-3 py-1 rounded-full text-xs font-medium shadow-md">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 inline-block animate-spin" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
</svg>
<span class="ml-1">Chargement...</span>
</div>
</div>
</div>
<div
class="absolute top-2 right-2 px-2 py-1 rounded-md text-xs font-medium shadow-sm"
:class="{
'bg-green-100 text-green-800': recipe.difficulty === 'Facile',
'bg-yellow-100 text-yellow-800': recipe.difficulty === 'Moyen',
'bg-red-100 text-red-800': recipe.difficulty === 'Difficile'
}"
x-text="recipe.difficulty"
></div>
</div>
<div class="p-4">
<div class="text-xs text-gray-500 uppercase tracking-wider mb-1" x-text="recipe.category"></div>
<h2 class="text-lg font-medium text-gray-800 mb-2" x-text="recipe.name"></h2>
<div class="flex justify-between items-center text-sm text-gray-500 mb-3">
<span class="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<span x-text="recipe.preparationTime + ' min'"></span>
</span>
</div>
<p class="text-gray-600 text-sm mb-4 h-10 overflow-hidden" x-text="recipe.description"></p>
<div class="flex justify-end">
<button
@click="openRecipeDetails(recipe)"
class="text-sm text-red-600 hover:text-red-800 font-medium inline-flex items-center"
>
Voir la recette
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 ml-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 5l7 7m0 0l-7 7m7-7H3" />
</svg>
</button>
</div>
</div>
</div>
</template>
</div>
</main>
<div
x-show="showRecipeDetails"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="transition ease-in duration-200"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
class="fixed inset-0 z-50 overflow-y-auto"
@click.self="closeRecipeDetails()"
>
<div class="flex items-center justify-center min-h-screen p-4">
<div
class="bg-white rounded-lg shadow-xl w-full max-w-4xl max-h-[90vh] overflow-y-auto"
@click.outside="closeRecipeDetails()"
>
<div x-show="selectedRecipe" class="relative">
<div class="relative h-64 sm:h-80 bg-gray-200">
<img
:src="selectedRecipe.imageUrl"
:alt="selectedRecipe.name"
class="absolute inset-0 w-full h-full object-cover"
>
<div class="absolute inset-0 bg-gradient-to-t from-black/30 to-transparent"></div>
<button
@click="closeRecipeDetails()"
class="absolute top-4 right-4 bg-black/50 text-white rounded-full p-2 hover:bg-black/70 transition-colors duration-200"
>
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
<div
class="absolute bottom-4 right-4 px-3 py-1 rounded-md text-xs font-medium shadow-md"
:class="{
'bg-green-100 text-green-800': selectedRecipe.difficulty === 'Facile',
'bg-yellow-100 text-yellow-800': selectedRecipe.difficulty === 'Moyen',
'bg-red-100 text-red-800': selectedRecipe.difficulty === 'Difficile'
}"
x-text="selectedRecipe.difficulty"
></div>
</div>
<div class="p-6">
<h2 class="text-2xl font-medium text-gray-800 mb-2" x-text="selectedRecipe.name"></h2>
<div class="flex flex-wrap gap-2 mb-5">
<span class="inline-block px-3 py-1 bg-gray-100 text-gray-600 rounded-md text-xs uppercase tracking-wider" x-text="selectedRecipe.category"></span>
<span class="inline-block px-3 py-1 bg-gray-100 text-gray-600 rounded-md text-xs uppercase tracking-wider">
<svg xmlns="http://www.w3.org/2000/svg" class="inline-block h-3 w-3 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<span x-text="selectedRecipe.preparationTime + ' min'"></span>
</span>
<span class="inline-block px-3 py-1 bg-gray-100 text-gray-600 rounded-md text-xs uppercase tracking-wider">
<svg xmlns="http://www.w3.org/2000/svg" class="inline-block h-3 w-3 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" />
</svg>
<span x-text="selectedRecipe.servings + ' personnes'"></span>
</span>
</div>
<div class="mb-6">
<h3 class="text-lg font-medium text-gray-800 mb-2">Description</h3>
<p class="text-gray-600" x-text="selectedRecipe.description"></p>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6">
<div class="md:col-span-1">
<h3 class="text-lg font-medium text-gray-800 mb-2 flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2 text-red-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" />
</svg>
ingredients
</h3>
<ul class="space-y-2">
<template x-for="(ingredient, index) in selectedRecipe.ingredients" :key="index">
<li class="text-gray-600 flex items-start">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2 text-green-500 flex-shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
</svg>
<span x-text="ingredient"></span>
</li>
</template>
</ul>
</div>
<div class="md:col-span-2">
<h3 class="text-lg font-medium text-gray-800 mb-2 flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2 text-red-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 14l-7 7m0 0l-7-7m7 7V3" />
</svg>
Instructions
</h3>
<div class="mb-8 bg-red-50 p-5 rounded-lg border border-red-100">
<template x-for="(step, index) in selectedRecipe.instructions" :key="index">
<div
x-show="currentStep === index"
x-transition:enter="transition ease-in-out duration-300"
x-transition:enter-start="opacity-0 transform translate-x-4"
x-transition:enter-end="opacity-100 transform translate-x-0"
x-transition:leave="transition ease-in-out duration-300"
x-transition:leave-start="opacity-100 transform translate-x-0"
x-transition:leave-end="opacity-0 transform translate-x-4"
class="text-gray-700"
>
<div class="flex items-start">
<div class="flex-shrink-0 bg-red-600 text-white rounded-full h-8 w-8 flex items-center justify-center font-medium mr-4" x-text="index + 1"></div>
<p class="text-gray-700" x-text="step"></p>
</div>
</div>
</template>
</div>
<div class="w-full bg-gray-200 rounded-full h-1.5 mb-4">
<div
class="bg-red-600 h-1.5 rounded-full transition-all duration-300 ease-in-out"
:style="`width: ${(currentStep + 1) / selectedRecipe.instructions.length * 100}%`"
></div>
</div>
<div class="text-center mb-4 text-gray-500 text-sm">
Étape <span class="font-medium text-red-600" x-text="currentStep + 1"></span> sur <span x-text="selectedRecipe.instructions.length"></span>
</div>
<div class="flex justify-between">
<button
@click="currentStep > 0 ? currentStep-- : null"
class="px-4 py-2 rounded-md flex items-center text-sm"
:class="currentStep > 0 ? 'bg-red-600 text-white hover:bg-red-700' : 'bg-gray-100 text-gray-400 cursor-not-allowed'"
:disabled="currentStep === 0"
>
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" />
</svg>
Précédent
</button>
<button
@click="currentStep < selectedRecipe.instructions.length - 1 ? currentStep++ : null"
class="px-4 py-2 rounded-md flex items-center text-sm"
:class="currentStep < selectedRecipe.instructions.length - 1 ? 'bg-red-600 text-white hover:bg-red-700' : 'bg-gray-100 text-gray-400 cursor-not-allowed'"
:disabled="currentStep === selectedRecipe.instructions.length - 1"
>
Suivant
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 ml-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
</svg>
</button>
</div>
</div>
</div>
<div class="flex justify-end pt-4 border-t border-gray-100">
<button
@click="closeRecipeDetails()"
class="px-6 py-2 bg-red-600 text-white rounded-md hover:bg-red-700 transition-colors duration-200 text-sm font-medium"
>
Fermer
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div
x-show="showRecipeDetails"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="transition ease-in duration-200"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
class="fixed inset-0 bg-black bg-opacity-50 z-40"
></div>
</div>
<script src="./src/main.js"></script>
</body>
</html>