From b8d1a76078e80d6c92c706ef439835ae6ee0a619 Mon Sep 17 00:00:00 2001 From: kirbo Date: Tue, 11 Jun 2024 20:43:58 -0700 Subject: [PATCH 1/2] add adaptable volume icons --- src/components/Icon.tsx | 4 ++++ src/components/player/atoms/Volume.tsx | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/Icon.tsx b/src/components/Icon.tsx index 51bd0de66..611c7a2dc 100644 --- a/src/components/Icon.tsx +++ b/src/components/Icon.tsx @@ -27,6 +27,8 @@ export enum Icons { EXPAND = "expand", COMPRESS = "compress", VOLUME = "volume", + VOLUME_MED = "volume_med", + VOLUME_LOW = "volume_low", VOLUME_X = "volume_x", X = "x", EDIT = "edit", @@ -98,6 +100,8 @@ const iconList: Record = { expand: ``, compress: ``, volume: ``, + volume_med: ``, + volume_low: ``, volume_x: ``, x: ``, edit: ``, diff --git a/src/components/player/atoms/Volume.tsx b/src/components/player/atoms/Volume.tsx index 62662de1f..aca9f8f40 100644 --- a/src/components/player/atoms/Volume.tsx +++ b/src/components/player/atoms/Volume.tsx @@ -62,6 +62,19 @@ export function Volume(props: Props) { [volume, setVolume], ); + const getVolumeIcon = (volumeLevel: number) => { + if (volumeLevel === 0) { + return Icons.VOLUME_X; + } + if (volumeLevel > 0 && volumeLevel <= 0.33) { + return Icons.VOLUME_LOW; + } + if (volumeLevel > 0.33 && volumeLevel <= 0.66) { + return Icons.VOLUME_MED; + } + return Icons.VOLUME; + }; + return (
- 0 ? Icons.VOLUME : Icons.VOLUME_X} /> +
Date: Tue, 11 Jun 2024 20:56:17 -0700 Subject: [PATCH 2/2] fix volume_x icon bulgyness --- src/components/Icon.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Icon.tsx b/src/components/Icon.tsx index 611c7a2dc..4ff1d34cb 100644 --- a/src/components/Icon.tsx +++ b/src/components/Icon.tsx @@ -102,7 +102,7 @@ const iconList: Record = { volume: ``, volume_med: ``, volume_low: ``, - volume_x: ``, + volume_x: ``, x: ``, edit: ``, bookmark_outline: ``,