import { useEditor } from '@bigbluebutton/editor' import { Range, Root, Thumb, Track } from '@radix-ui/react-slider' import { memo, useCallback } from 'react' import { TLUiTranslationKey } from '../../hooks/useTranslation/TLUiTranslationKey' import { useTranslation } from '../../hooks/useTranslation/useTranslation' /** @internal */ export interface SliderProps { steps: number value: number | null label: string title: string onValueChange: (value: number, emphemeral: boolean) => void 'data-testid'?: string } /** @internal */ export const Slider = memo(function Slider(props: SliderProps) { const { title, steps, value, label, onValueChange } = props const editor = useEditor() const msg = useTranslation() const handleValueChange = useCallback( (value: number[]) => { onValueChange(value[0], true) }, [onValueChange] ) const handlePointerDown = useCallback(() => { editor.mark('click slider') }, [editor]) const handlePointerUp = useCallback(() => { if (!value) return onValueChange(value, false) }, [value, onValueChange]) return (
{value !== null && } {value !== null && }
) })