import React from 'react'; import { Volume2, VolumeX } from 'lucide-react'; import type { TFunction } from 'i18next'; interface Props { volume: number; setVolume: (v: number) => void; premuteVolumeRef: React.MutableRefObject; showVolPct: boolean; setShowVolPct: (v: boolean) => void; handleVolume: (e: React.ChangeEvent) => void; handleVolumeWheel: (e: React.WheelEvent) => void; volumeStyle: React.CSSProperties; inputId: string; /** 'menu' adds the --menu modifier to the outer section (used inside the * overflow menu so the layout adapts). Defaults to no modifier. */ sectionModifier?: 'menu'; /** 'menu-only' adds the --menu-only modifier to the slider wrap, widening * it when the menu is in volume-only mode. */ wrapModifier?: 'menu-only'; t: TFunction; } export function PlayerVolume({ volume, setVolume, premuteVolumeRef, showVolPct, setShowVolPct, handleVolume, handleVolumeWheel, volumeStyle, inputId, sectionModifier, wrapModifier, t, }: Props) { const sectionClass = `player-volume-section${sectionModifier ? ` player-volume-section--${sectionModifier}` : ''}`; const wrapClass = `player-volume-slider-wrap${wrapModifier ? ` player-volume-slider-wrap--${wrapModifier}` : ''}`; return (
{showVolPct && ( {Math.round(volume * 100)}% )} setShowVolPct(true)} onMouseLeave={() => setShowVolPct(false)} />
); }