From 1a8160a21ac97b42acb5cbd5b1be3831dbb970e0 Mon Sep 17 00:00:00 2001 From: Edson Pimenta Date: Tue, 12 Dec 2023 14:49:33 -0300 Subject: [PATCH] refactor(form): :recycle: enhances form validation --- src/pages/Checkout/index.tsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/pages/Checkout/index.tsx b/src/pages/Checkout/index.tsx index 6fc2c2e..d1f0b12 100644 --- a/src/pages/Checkout/index.tsx +++ b/src/pages/Checkout/index.tsx @@ -104,6 +104,7 @@ export function Checkout() { setStreet(e.target.value)} />
@@ -123,6 +125,7 @@ export function Checkout() { type="number" min={0} required + disabled={!products.length} onChange={(e) => setNumber(e.target.value)} />
@@ -130,6 +133,7 @@ export function Checkout() { @@ -140,6 +144,7 @@ export function Checkout() { placeholder={t("neighbourhood")} type="text" required + disabled={!products.length} onChange={(e) => setNeighborhood(e.target.value)} /> @@ -149,6 +154,7 @@ export function Checkout() { placeholder={t("city")} type="text" required + disabled={!products.length} onChange={(e) => setCity(e.target.value)} /> @@ -158,6 +164,7 @@ export function Checkout() { type="text" maxLength={2} required + disabled={!products.length} onChange={(e) => setState(e.target.value)} /> @@ -185,6 +192,7 @@ export function Checkout() { type="button" className="group max-w-[14rem] flex-grow outline-none" onClick={() => setSelectedPaymentType("credit")} + disabled={!products.length} > setSelectedPaymentType("debit")} + disabled={!products.length} > setSelectedPaymentType("money")} + disabled={!products.length} > ) : ( -

Adicione produtos

+

{t("noProductsInCheckout")}

)}