diff --git a/apps/site/app/_components/audio/player.tsx b/apps/site/app/_components/audio/player.tsx index 27f5eee..b3863f0 100644 --- a/apps/site/app/_components/audio/player.tsx +++ b/apps/site/app/_components/audio/player.tsx @@ -61,6 +61,11 @@ export function AudioPlayer() { } }, [playbackState]); + const getThumbProps = useCallback((value: number) => ({ + 'aria-label': `Current value: ${value}`, + title: `Current value: ${value}`, + }), []); + return ( @@ -88,6 +93,7 @@ export function AudioPlayer() { onValueChange={audioHandlers.onValueChange} onValueCommit={audioHandlers.onValueCommit} aria-label={`Playback progress: ${playtime(currentTime)} of ${playtime(duration)}`} + thumbProps={getThumbProps(currentTime)} />
@@ -112,6 +118,7 @@ export function AudioPlayer() { step={1} {...volumeHandlers} aria-label={`Volume control: ${localVolume}%`} + thumbProps={getThumbProps(localVolume)} />
diff --git a/packages/ui/src/components/ui/slider.tsx b/packages/ui/src/components/ui/slider.tsx index 591436c..95d8232 100644 --- a/packages/ui/src/components/ui/slider.tsx +++ b/packages/ui/src/components/ui/slider.tsx @@ -1,28 +1,34 @@ -'use client' +'use client'; -import * as SliderPrimitive from '@radix-ui/react-slider' -import * as React from 'react' +import * as React from 'react'; +import * as SliderPrimitive from '@radix-ui/react-slider'; -import { cn } from '@omi3/utils' +import { cn } from '@omi3/utils'; -const Slider = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - - - - - - -)) -Slider.displayName = SliderPrimitive.Root.displayName +interface SliderProps extends React.ComponentPropsWithoutRef { + thumbProps?: React.ComponentPropsWithoutRef; +} -export { Slider } +const Slider = React.forwardRef, SliderProps>( + ({ className, thumbProps, ...props }, ref) => ( + + + + + + + ), +); +Slider.displayName = SliderPrimitive.Root.displayName; + +export { Slider };