Skip to content

Commit

Permalink
[fix] create new slot only on blur
Browse files Browse the repository at this point in the history
  • Loading branch information
inosms committed Jan 7, 2024
1 parent c4bc899 commit f52bb78
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/SlotTime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,18 @@ export function SlotTime({ time, setTime, minTime, maxTime, onRemove }: { time:

const newTime = parseTimeString(e.target.value);
if (newTime !== null && newTime >= minTime && newTime <= maxTime) {
setTime(newTime);
setTimeStateValid(true);
} else {
setTimeStateValid(false);
}
}} />
}}
onBlur={() => {
const newTime = parseTimeString(timeState);
if (newTime && timeStateValid) {
setTime(newTime);
}
}}
/>

{onRemove ? <button onClick={() => onRemove()}>Remove Slot</button> : null}
</div>
Expand Down

0 comments on commit f52bb78

Please sign in to comment.