Spaces:
Sleeping
Sleeping
Update components/cards.py
Browse files- components/cards.py +15 -10
components/cards.py
CHANGED
@@ -6,21 +6,26 @@ def create_food_card(food_name):
|
|
6 |
nutrition = food_info["nutrition"]
|
7 |
portion_size = food_info["portion_size"]
|
8 |
|
9 |
-
# HTML for card
|
10 |
card_html = f"""
|
11 |
<div class="food-card">
|
|
|
12 |
<div class="card-header">
|
13 |
-
<img src="{image_src}" alt="{food_name}" class="food-image" />
|
14 |
<button class="close-btn" onclick="document.querySelector('.food-card').style.display='none'">✖</button>
|
|
|
15 |
</div>
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
24 |
</div>
|
25 |
</div>
|
26 |
"""
|
|
|
6 |
nutrition = food_info["nutrition"]
|
7 |
portion_size = food_info["portion_size"]
|
8 |
|
9 |
+
# Updated HTML for card to mimic screenshot structure
|
10 |
card_html = f"""
|
11 |
<div class="food-card">
|
12 |
+
<!-- Header Section -->
|
13 |
<div class="card-header">
|
|
|
14 |
<button class="close-btn" onclick="document.querySelector('.food-card').style.display='none'">✖</button>
|
15 |
+
<img src="{image_src}" alt="{food_name}" class="food-image" />
|
16 |
</div>
|
17 |
+
|
18 |
+
<!-- Bottom Section -->
|
19 |
+
<div class="card-content">
|
20 |
+
<div class="nutrition-details">
|
21 |
+
<h3>{food_name}</h3>
|
22 |
+
<table>
|
23 |
+
{"".join([f"<tr><td>{key}</td><td>{value}</td></tr>" for key, value in nutrition.items()])}
|
24 |
+
</table>
|
25 |
+
</div>
|
26 |
+
<div class="portion-details">
|
27 |
+
<p><strong>Portion Size:</strong> {portion_size}</p>
|
28 |
+
</div>
|
29 |
</div>
|
30 |
</div>
|
31 |
"""
|