From da2631822f902094e691143302d6fc6b68e1cf56 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Wed, 24 May 2023 20:18:00 -0600 Subject: Añade lógica de carrito MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/forms/fields/field.tsx | 4 ++-- src/components/info_modal.tsx | 37 +++++++++++++++++++++++++++++++++++ src/components/product_cart.tsx | 35 ++++++++++++++++++++++++--------- 3 files changed, 65 insertions(+), 11 deletions(-) create mode 100644 src/components/info_modal.tsx (limited to 'src/components') diff --git a/src/components/forms/fields/field.tsx b/src/components/forms/fields/field.tsx index d7aa342..8faa425 100644 --- a/src/components/forms/fields/field.tsx +++ b/src/components/forms/fields/field.tsx @@ -5,7 +5,7 @@ export default function Field({ properties }) { field_component = (
- +

{properties.error_message }

); @@ -14,7 +14,7 @@ export default function Field({ properties }) { field_component = (
- +
); } diff --git a/src/components/info_modal.tsx b/src/components/info_modal.tsx new file mode 100644 index 0000000..1123901 --- /dev/null +++ b/src/components/info_modal.tsx @@ -0,0 +1,37 @@ +import { Modal } from "flowbite"; +import "./stylesheets/shared.css"; + +function createModal() { + const target = document.getElementById('info-modal'); + const button = document.getElementById('modal-button'); + const options = { + placement: 'center-center', + backdrop: 'dynamic', + backdropClasses: 'bg-gray-900 bg-opacity-50 dark:bg-opacity-80 fixed inset-0 z-40', + closable: true + }; + + const new_modal = new Modal(target, options); + button?.addEventListener('click', () => new_modal.hide()); + + return new_modal; +} + +export function InfoModal({ text }) { + + return ( + + ); +} \ No newline at end of file diff --git a/src/components/product_cart.tsx b/src/components/product_cart.tsx index 86d2615..4e78d1a 100644 --- a/src/components/product_cart.tsx +++ b/src/components/product_cart.tsx @@ -1,27 +1,44 @@ +import { Form } from "react-router-dom"; import "./stylesheets/product_listing.css"; export default function ProductCart({ product }) { return ( -
-
+
+
-
+
{product.name}
+
+ Precio unitario +
- - Precio unitario - {product.unitary_price}
+
+ Precio al por mayor +
- - Precio al por mayor - {product.bulk_price}
+
+
+ Cantidad en carrito: +
+
+ {product.quantity} +
+
+
+ + +
+
+
); -- cgit v1.2.3