Skip to content

Commit

Permalink
feat: disable input and buttons
Browse files Browse the repository at this point in the history
This ensures that the user cannot add a new task while another one is in progress.
  • Loading branch information
devgustavosantos committed Aug 14, 2024
1 parent 3d62686 commit ed203b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/pages/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ export function Home() {
placeholder="Dê um nome para o seu projeto"
list="suggestions"
{...taskNameRegister}
disabled={!!tasks.current}
/>
durante
<S.MinutesContainer>
<S.MinutesButtons
type="button"
title="Diminuir o tempo desejado"
onClick={() => handleDesiredTimeOnClick(false)}
disabled={!!tasks.current}
>
<Minus />
</S.MinutesButtons>
Expand All @@ -51,11 +53,13 @@ export function Home() {
max={TASK.desiredTime.max}
min={TASK.desiredTime.min}
{...desiredTimeRegister}
disabled={!!tasks.current}
/>
<S.MinutesButtons
type="button"
title="Aumentar o tempo desejado"
onClick={() => handleDesiredTimeOnClick(true)}
disabled={!!tasks.current}
>
<Plus />
</S.MinutesButtons>
Expand Down
3 changes: 2 additions & 1 deletion src/styles/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export const Global = createGlobalStyle`
}
button,
a {
a,
input {
&:disabled,
&:hover {
filter: brightness(0.8);
Expand Down

0 comments on commit ed203b7

Please sign in to comment.