From 2a4a4c3caafbc1d08161815fc8047f8954900b8e Mon Sep 17 00:00:00 2001 From: Leonardo Segala Date: Sat, 2 Aug 2025 04:34:45 +0200 Subject: [PATCH] Add minimal styling --- .../src/lib/components/SuggestionInput.svelte | 10 +++++-- .../src/lib/components/SuggestionList.svelte | 28 +++++++++++++------ frontend/tailwind.config.ts | 22 +++++++++++++++ 3 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 frontend/tailwind.config.ts diff --git a/frontend/src/lib/components/SuggestionInput.svelte b/frontend/src/lib/components/SuggestionInput.svelte index de8e437..09982fd 100644 --- a/frontend/src/lib/components/SuggestionInput.svelte +++ b/frontend/src/lib/components/SuggestionInput.svelte @@ -9,7 +9,11 @@ } -
- - +
+ + +
diff --git a/frontend/src/lib/components/SuggestionList.svelte b/frontend/src/lib/components/SuggestionList.svelte index 16cc08c..9c3d650 100644 --- a/frontend/src/lib/components/SuggestionList.svelte +++ b/frontend/src/lib/components/SuggestionList.svelte @@ -3,29 +3,39 @@ 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" }) }
- {#each suggestions as sug} -
+ {#if suggestions.length == 0} +

No suggestions yet! Try to add a new one using the Add button

+ {/if} + + {#each suggestions as sug, idx} +
Song cover -

{sug.title} - {sug.artist}

+
+

{sug.title}

+

{sug.artist}

+
👍 -

{sug.upvote}

+

{sug.upvote}

👍
diff --git a/frontend/tailwind.config.ts b/frontend/tailwind.config.ts new file mode 100644 index 0000000..16951d0 --- /dev/null +++ b/frontend/tailwind.config.ts @@ -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