Skip to content

Commit

Permalink
add margin to hold duration
Browse files Browse the repository at this point in the history
  • Loading branch information
zerts committed Jul 8, 2024
1 parent 782e699 commit 02a25a0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ui/ui-kit/Button/HoldableButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const ACTIVE_BACKGROUND_COLOR: Record<Kind, string> = {
const SHORT_PRESS_DURATION = 200;
const HINT_SHOW_DURATION = 1500;
const HINT_SHOW_MIN_BREAK = 2000;
const HOLD_DURATION_MARGIN = 100;

const ButtonElement = <As extends ElementType = 'button'>(
{
Expand Down Expand Up @@ -104,7 +105,7 @@ const ButtonElement = <As extends ElementType = 'button'>(
holdTimerRef.current = setTimeout(() => {
realButtonRef.current?.click();
setInnerState('idle');
}, holdDuration);
}, holdDuration + HOLD_DURATION_MARGIN);
}, [holdDuration]);

const handleMouseUp = useCallback(() => {
Expand Down

0 comments on commit 02a25a0

Please sign in to comment.