refactor(Slider.tsx): remove unused import and type declaration

fix(Slider.tsx): fix type error in onClick event handler
This commit is contained in:
Danny Avila 2023-08-09 09:35:23 -04:00 committed by Danny Avila
parent b896225bd8
commit 002bba20f9

View file

@ -1,12 +1,9 @@
'use client';
import * as React from 'react';
import * as SliderPrimitive from '@radix-ui/react-slider';
import { useDoubleClick } from '@zattoo/use-double-click';
import type { clickEvent } from '@zattoo/use-double-click';
import { cn } from '../../utils';
type clickEvent = (event: React.MouseEvent<HTMLButtonElement>) => void;
interface SliderProps extends React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root> {
doubleClickHandler?: clickEvent;
}
@ -23,7 +20,7 @@ const Slider = React.forwardRef<React.ElementRef<typeof SliderPrimitive.Root>, S
</SliderPrimitive.Track>
<SliderPrimitive.Thumb
onClick={
useDoubleClick(doubleClickHandler) ??
useDoubleClick(doubleClickHandler as clickEvent) ??
(() => {
return;
})