Skip to content

Commit 026c469

Browse files
committed
feat: add more sounds to name-breakdown
1 parent b699870 commit 026c469

6 files changed

Lines changed: 36 additions & 13 deletions

File tree

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,43 @@
11
<script lang="ts">
22
import { Volume2 } from 'lucide-svelte';
33
4-
function playSound() {
5-
const audio = new Audio('/sounds/codevogel.mp3');
6-
audio.play();
4+
let genderSoundNL: 'm' | 'f' = $state('f');
5+
let genderSoundUK: 'm' | 'f' = $state('m');
6+
7+
const audioNLMale = '/sounds/codevogel-nl-m.mp3';
8+
const audioNLFemale = '/sounds/codevogel-nl-f.mp3';
9+
const audioENMale = '/sounds/codevogel-en-m.mp3';
10+
const audioENFemale = '/sounds/codevogel-en-f.mp3';
11+
12+
function playSound(locale: 'nl' | 'en') {
13+
switch (locale) {
14+
case 'nl':
15+
new Audio(genderSoundNL === 'm' ? audioNLMale : audioNLFemale).play();
16+
genderSoundNL = genderSoundNL === 'm' ? 'f' : 'm';
17+
break;
18+
case 'en':
19+
new Audio(genderSoundUK === 'm' ? audioENMale : audioENFemale).play();
20+
genderSoundUK = genderSoundUK === 'm' ? 'f' : 'm';
21+
break;
22+
}
723
}
824
</script>
925

10-
<div class="mx-auto rounded-xl border-[.1px] border-accent p-4 text-center md:p-8 md:text-xl">
11-
<p>
12-
<span class="flex flex-row justify-center gap-x-4">
13-
<span class="font-serif italic">/ˈkoːdəˌvoːɣəl/</span>
14-
<button on:click={playSound}
15-
><Volume2 class="stroke-foreground/50 hover:stroke-foreground" /></button
16-
></span
17-
>
18-
A bird that enjoys programming.
19-
</p>
26+
<div
27+
class="mx-auto flex flex-col items-center justify-center rounded-xl border-[.1px] border-accent p-4 text-center md:p-8 md:text-xl"
28+
>
29+
<span class="flex flex-col gap-x-4">
30+
<span class="flex flex-col font-serif italic">/ˈkoːdəˌvoːɣəl/</span>
31+
</span>
32+
<p>A bird that enjoys programming.</p>
33+
<span class="mt-2 flex flex-row gap-x-4">
34+
<button onclick={() => playSound('nl')} class="flex flex-row gap-x-1">
35+
<Volume2 class="stroke-foreground/50 hover:stroke-foreground" />
36+
<span> 🇳🇱</span>
37+
</button>
38+
<button onclick={() => playSound('en')} class="flex flex-row gap-x-1">
39+
<Volume2 class="stroke-foreground/50 hover:stroke-foreground" />
40+
<span> 🇬🇧 </span>
41+
</button>
42+
</span>
2043
</div>
27.2 KB
Binary file not shown.
40 KB
Binary file not shown.
25.7 KB
Binary file not shown.
23.3 KB
Binary file not shown.

app/static/sounds/codevogel.mp3

-54.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)