Make no thumb slider height dynamic

This commit is contained in:
Nicolas Mowen 2024-04-19 14:47:14 -06:00
parent 3b0f9988df
commit 5e4c075340
2 changed files with 4 additions and 3 deletions

View File

@ -520,6 +520,7 @@ export function VideoPreview({
const onStopManualSeek = useCallback(() => { const onStopManualSeek = useCallback(() => {
setTimeout(() => { setTimeout(() => {
setIgnoreClick(false); setIgnoreClick(false);
setHoverTimeout(undefined);
if (isSafari || (isFirefox && isMobile)) { if (isSafari || (isFirefox && isMobile)) {
setManualPlayback(true); setManualPlayback(true);
@ -565,7 +566,7 @@ export function VideoPreview({
{showProgress && ( {showProgress && (
<NoThumbSlider <NoThumbSlider
ref={sliderRef} ref={sliderRef}
className="absolute inset-x-0 bottom-0 z-30" className={`absolute inset-x-0 bottom-0 z-30 cursor-col-resize ${hoverTimeout != undefined ? "h-4" : "h-2"}`}
value={[progress]} value={[progress]}
onValueChange={onManualSeek} onValueChange={onManualSeek}
onValueCommit={onStopManualSeek} onValueCommit={onStopManualSeek}
@ -740,7 +741,7 @@ export function InProgressPreview({
{showProgress && ( {showProgress && (
<NoThumbSlider <NoThumbSlider
ref={sliderRef} ref={sliderRef}
className="absolute inset-x-0 bottom-0 z-30" className={`absolute inset-x-0 bottom-0 z-30 cursor-col-resize ${manualFrame ? "h-4" : "h-2"}`}
value={[key]} value={[key]}
onValueChange={onManualSeek} onValueChange={onManualSeek}
onValueCommit={onStopManualSeek} onValueCommit={onStopManualSeek}

View File

@ -55,7 +55,7 @@ const NoThumbSlider = React.forwardRef<
)} )}
{...props} {...props}
> >
<SliderPrimitive.Track className="relative h-2 w-full grow overflow-hidden rounded-full"> <SliderPrimitive.Track className="relative h-full w-full grow overflow-hidden rounded-full">
<SliderPrimitive.Range className="absolute h-full bg-selected" /> <SliderPrimitive.Range className="absolute h-full bg-selected" />
</SliderPrimitive.Track> </SliderPrimitive.Track>
<SliderPrimitive.Thumb className="block h-4 w-16 rounded-full bg-transparent -translate-y-[50%] ring-offset-transparent focus-visible:outline-none focus-visible:ring-transparent disabled:pointer-events-none disabled:opacity-50 cursor-col-resize" /> <SliderPrimitive.Thumb className="block h-4 w-16 rounded-full bg-transparent -translate-y-[50%] ring-offset-transparent focus-visible:outline-none focus-visible:ring-transparent disabled:pointer-events-none disabled:opacity-50 cursor-col-resize" />