team-1/frontend/src/lib/components/SuggestionInput.svelte

30 lines
932 B
Svelte
Raw Normal View History

2025-08-01 21:10:03 +02:00
<script lang="ts">
2025-08-02 02:12:41 +02:00
let { roomId } = $props()
let input = $state("")
async function sendSong() {
2025-08-02 09:19:39 +02:00
await fetch(`/api/addsong?room=${roomId}&query=${input}`, { method: "POST" })
2025-08-02 02:12:41 +02:00
input = ""
}
2025-08-01 21:10:03 +02:00
</script>
2025-08-02 09:19:39 +02:00
<div class="flex h-full w-full flex-row items-center gap-2 rounded border-2 border-lime-600 bg-lime-500">
<input
type="text"
placeholder="Song & Artist"
class="h-[50px] w-3/4 rounded px-4 font-bold text-white outline-none"
bind:value={input}
onkeydown={(e) => {
if (e.key == "Enter") {
sendSong()
}
}}
/>
2025-08-02 04:34:45 +02:00
<button
2025-08-02 09:19:39 +02:00
class="i-lucide-check h-[40px] w-1/4 cursor-pointer rounded border-2 border-lime-700 bg-lime-600 font-semibold text-white shadow-xl duration-100 hover:scale-105 active:scale-90"
2025-08-02 04:34:45 +02:00
onclick={sendSong}>Add</button
>
<span class="i-lucide-chevrons-left"></span>
2025-08-01 21:10:03 +02:00
</div>