From ed203b708583278ccfe57589e448d835c11163bd Mon Sep 17 00:00:00 2001 From: Gustavo Santos Date: Wed, 14 Aug 2024 08:42:23 -0300 Subject: [PATCH] feat: disable input and buttons This ensures that the user cannot add a new task while another one is in progress. --- src/pages/Home/index.tsx | 4 ++++ src/styles/global.ts | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/Home/index.tsx b/src/pages/Home/index.tsx index b5110d3..40cff32 100644 --- a/src/pages/Home/index.tsx +++ b/src/pages/Home/index.tsx @@ -35,6 +35,7 @@ export function Home() { placeholder="DĂȘ um nome para o seu projeto" list="suggestions" {...taskNameRegister} + disabled={!!tasks.current} /> durante @@ -42,6 +43,7 @@ export function Home() { type="button" title="Diminuir o tempo desejado" onClick={() => handleDesiredTimeOnClick(false)} + disabled={!!tasks.current} > @@ -51,11 +53,13 @@ export function Home() { max={TASK.desiredTime.max} min={TASK.desiredTime.min} {...desiredTimeRegister} + disabled={!!tasks.current} /> handleDesiredTimeOnClick(true)} + disabled={!!tasks.current} > diff --git a/src/styles/global.ts b/src/styles/global.ts index b188aae..2e8dd52 100644 --- a/src/styles/global.ts +++ b/src/styles/global.ts @@ -41,7 +41,8 @@ export const Global = createGlobalStyle` } button, - a { + a, + input { &:disabled, &:hover { filter: brightness(0.8);