Add minimal styling

This commit is contained in:
Leonardo Segala 2025-08-02 04:34:45 +02:00
parent a6a7eeb690
commit 2a4a4c3caa
3 changed files with 48 additions and 12 deletions

View file

@ -9,7 +9,11 @@
} }
</script> </script>
<div class="flex h-full w-full flex-row items-center gap-2 rounded border-2 border-black p-4"> <div class="bg-lime-500 flex h-full w-full flex-row items-center gap-2 rounded border-2 border-lime-600">
<input type="text" placeholder="Song & Artist" class="h-full w-3/4 rounded" bind:value={input} /> <input type="text" placeholder="Song & Artist" class="font-bold outline-none text-white h-[50px] px-4 w-3/4 rounded" bind:value={input} />
<button class="w-1/4 rounded" onclick={sendSong}>Send</button> <button
class="shadow-xl hover:scale-105 w-1/4 h-[40px] cursor-pointer bg-lime-600 border-lime-700 font-semibold text-white border-2 i-lucide-check rounded active:scale-90 duration-100"
onclick={sendSong}>Add</button
>
<span class="i-lucide-chevrons-left"></span>
</div> </div>

View file

@ -3,29 +3,39 @@
let { suggestions, roomId }: { suggestions: Suggestion[]; roomId: string } = $props() let { suggestions, roomId }: { suggestions: Suggestion[]; roomId: string } = $props()
async function vote(amount: number, songId: string) { async function vote(idx: number, amount: number, songId: string) {
suggestions[idx].upvote += amount
await fetch(`/api/song/voting?room=${roomId}&song=${songId}&increment=${amount}`, { method: "POST" }) await fetch(`/api/song/voting?room=${roomId}&song=${songId}&increment=${amount}`, { method: "POST" })
} }
</script> </script>
<div class="flex h-full w-full flex-col items-center gap-2 overflow-y-auto"> <div class="flex h-full w-full flex-col items-center gap-2 overflow-y-auto">
{#each suggestions as sug} {#if suggestions.length == 0}
<div class="flex h-[80px] w-full flex-row gap-2 rounded border-2 border-black p-2"> <p>No suggestions yet! Try to add a new one using the <b>Add</b> button</p>
{/if}
{#each suggestions as sug, idx}
<div class="shadow-md hover:bg-indigo-400 duration-100 bg-indigo-500 flex h-[80px] w-full flex-row gap-2 rounded border-2 border-indigo-600 p-2">
<div class="flex w-3/4 flex-row gap-2"> <div class="flex w-3/4 flex-row gap-2">
<img class="w-[60px] min-w-[60px] rounded" src={`https://lastfm.freetls.fastly.net/i/u/174s/${sug.image_id}.png`} alt="Song cover" /> <img class="w-[60px] min-w-[60px] rounded" src={`https://lastfm.freetls.fastly.net/i/u/174s/${sug.image_id}.png`} alt="Song cover" />
<h1>{sug.title} - {sug.artist}</h1> <div class="text-white">
<p>{sug.title}</p>
<p>{sug.artist}</p>
</div>
</div> </div>
<div class="flex w-1/4 flex-row items-center justify-center gap-2"> <div class="flex w-1/4 flex-row items-center justify-center gap-2">
<button <button
class="grayscale"
onclick={() => { onclick={() => {
vote(1, sug.uuid) vote(idx, 1, sug.uuid)
}}>+1</button }}>👍</button
> >
<p>{sug.upvote}</p> <p class="text-white font-semibold">{sug.upvote}</p>
<button <button
class="hover:scale-150 duration-100"
onclick={() => { onclick={() => {
vote(-1, sug.uuid) vote(idx, -1, sug.uuid)
}}>-1</button }}><div class="rotate-180">👍</div></button
> >
</div> </div>
</div> </div>

View file

@ -0,0 +1,22 @@
import type { Config } from "tailwindcss"
const { iconsPlugin, getIconCollections } = require("@egoist/tailwindcss-icons")
export default {
content: ["./src/**/*.{html,js,svelte,ts}"],
theme: {
extend: {},
},
plugins: [
iconsPlugin({
// Select the icon collections you want to use
// You can also ignore this option to automatically discover all individual icon packages you have installed
// If you install @iconify/json, you should explicitly specify the collections you want to use, like this:
collections: getIconCollections(["lucide"]),
// If you want to use all icons from @iconify/json, you can do this:
// collections: getIconCollections("all"),
// and the more recommended way is to use `dynamicIconsPlugin`, see below.
}),
],
} satisfies Config