Spaces:
Sleeping
Sleeping
Update components/popup_card.py
Browse files- components/popup_card.py +10 -15
components/popup_card.py
CHANGED
@@ -1,26 +1,21 @@
|
|
1 |
def generate_popup_card(name, model_path):
|
2 |
"""
|
3 |
-
Generates an HTML popup card dynamically for the selected menu item with
|
4 |
"""
|
5 |
html_content = f"""
|
6 |
<div id="overlay" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.8); z-index: 9999; display: flex; justify-content: center; align-items: center;">
|
7 |
-
<div style="border: 1px solid #ddd; padding: 20px; border-radius: 10px; background-color: #fff; width:
|
8 |
-
<h2 style="text-align: center; color: #333;">{name}</h2>
|
9 |
-
<model-viewer src="{model_path}" alt="3D Model of {name}" camera-controls auto-rotate style="width: 100%;"></model-viewer>
|
10 |
-
<label for="instructions" style="display: block; margin-
|
11 |
-
<textarea id="instructions" placeholder="Add any requests here..." style="width: 100%; margin-bottom: 10px;"></textarea>
|
12 |
-
<label for="quantity" style="display: block;">Quantity:</label>
|
13 |
-
<input type="number" id="quantity" min="1" max="10" value="1" style="width: 100%; margin-bottom: 10px;">
|
14 |
<div style="text-align: center;">
|
15 |
-
<button style="
|
16 |
-
<button style="
|
17 |
</div>
|
18 |
</div>
|
19 |
</div>
|
20 |
-
<script>
|
21 |
-
function closePopup() {{
|
22 |
-
document.getElementById('overlay').style.display = 'none';
|
23 |
-
}}
|
24 |
-
</script>
|
25 |
"""
|
26 |
return html_content
|
|
|
1 |
def generate_popup_card(name, model_path):
|
2 |
"""
|
3 |
+
Generates an HTML popup card dynamically for the selected menu item with proper close functionality.
|
4 |
"""
|
5 |
html_content = f"""
|
6 |
<div id="overlay" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.8); z-index: 9999; display: flex; justify-content: center; align-items: center;">
|
7 |
+
<div style="border: 1px solid #ddd; padding: 20px; border-radius: 10px; background-color: #fff; width: 350px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);">
|
8 |
+
<h2 style="text-align: center; color: #333; margin-bottom: 10px;">{name}</h2>
|
9 |
+
<model-viewer src="{model_path}" alt="3D Model of {name}" camera-controls auto-rotate style="width: 100%; margin-bottom: 10px;"></model-viewer>
|
10 |
+
<label for="instructions" style="display: block; margin-bottom: 5px; font-weight: bold;">Special Instructions:</label>
|
11 |
+
<textarea id="instructions" placeholder="Add any requests here..." style="width: 100%; margin-bottom: 10px; padding: 5px; border: 1px solid #ccc; border-radius: 5px;"></textarea>
|
12 |
+
<label for="quantity" style="display: block; font-weight: bold; margin-bottom: 5px;">Quantity:</label>
|
13 |
+
<input type="number" id="quantity" min="1" max="10" value="1" style="width: 100%; margin-bottom: 10px; padding: 5px; border: 1px solid #ccc; border-radius: 5px;">
|
14 |
<div style="text-align: center;">
|
15 |
+
<button style="padding: 10px 20px; background-color: #008cba; color: white; border: none; border-radius: 5px; cursor: pointer;">Add to Cart</button>
|
16 |
+
<button style="padding: 10px 20px; background-color: #ccc; color: black; border: none; border-radius: 5px; margin-left: 10px; cursor: pointer;" onclick="document.getElementById('overlay').style.display='none'">Close</button>
|
17 |
</div>
|
18 |
</div>
|
19 |
</div>
|
|
|
|
|
|
|
|
|
|
|
20 |
"""
|
21 |
return html_content
|