Skip to content

Commit

Permalink
fix: visual bug in the desired time input
Browse files Browse the repository at this point in the history
Now, when starting the application, the placeholder text is shown to the user.
  • Loading branch information
devgustavosantos committed Jul 22, 2024
1 parent 36178a0 commit f51e202
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pages/Home/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import { DESIRED_TIME } from './utils';

export function useHome() {
const [taskName, setTaskName] = useState('');
const [desiredTime, setDesiredTime] = useState(0);
const [desiredTime, setDesiredTime] = useState<number | undefined>(undefined);

function handleDesiredTime(add: boolean) {
const currentValue = desiredTime ?? 0;

const chosenTime = add
? desiredTime + DESIRED_TIME.step
: desiredTime - DESIRED_TIME.step;
? currentValue + DESIRED_TIME.step
: currentValue - DESIRED_TIME.step;

if (chosenTime <= DESIRED_TIME.min) {
setDesiredTime(DESIRED_TIME.min);
Expand Down

0 comments on commit f51e202

Please sign in to comment.