-
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathPlayButton.svelte
More file actions
32 lines (27 loc) · 897 Bytes
/
PlayButton.svelte
File metadata and controls
32 lines (27 loc) · 897 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
30
31
32
<script lang="ts">
import config from '$assets/config';
import { AudioIcon } from '$lib/icons';
const icons = {
arrow: {
play: AudioIcon.Play,
pause: AudioIcon.Pause
},
'outline-circle': {
play: AudioIcon.PlayOutlineCircle,
pause: AudioIcon.PauseOutlineCircle
}
};
interface Props {
color?: string;
state: 'play' | 'pause';
onclick: () => any;
}
let { color = 'black', state, onclick }: Props = $props();
const size = config.mainFeatures['audio-play-button-size'] === 'normal' ? 24 : 48;
const style = config.mainFeatures['audio-play-button-style'] as keyof typeof icons;
const icon_style = icons[style];
const Icon = $derived(icon_style[state]);
</script>
<button class="audio-control-buttons" {onclick}>
<Icon {color} {size} />
</button>