-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathVolumeSlider.tsx
More file actions
29 lines (27 loc) · 863 Bytes
/
VolumeSlider.tsx
File metadata and controls
29 lines (27 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import React from "react";
import { useTranslation } from "react-i18next";
import { Slider } from "../ui/Slider";
import { useSettings } from "../../hooks/useSettings";
export const VolumeSlider: React.FC<{ disabled?: boolean }> = ({
disabled = false,
}) => {
const { t } = useTranslation();
const { getSetting, updateSetting } = useSettings();
const audioFeedbackVolume = getSetting("audio_feedback_volume") ?? 0.5;
return (
<Slider
value={audioFeedbackVolume}
onChange={(value: number) =>
updateSetting("audio_feedback_volume", value)
}
min={0}
max={1}
label={t("settings.sound.volume.title")}
description={t("settings.sound.volume.description")}
descriptionMode="tooltip"
grouped
formatValue={(value) => `${Math.round(value * 100)}%`}
disabled={disabled}
/>
);
};