From a611362ad84711d42c2cbda6ad0184a6433b46f5 Mon Sep 17 00:00:00 2001 From: Jakob Moser Date: Thu, 13 Nov 2025 20:01:16 +0100 Subject: [PATCH] Add Song class --- .../ui/static/components/pieces/Song.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 karaokatalog/ui/static/components/pieces/Song.js diff --git a/karaokatalog/ui/static/components/pieces/Song.js b/karaokatalog/ui/static/components/pieces/Song.js new file mode 100644 index 0000000..9ff4ba3 --- /dev/null +++ b/karaokatalog/ui/static/components/pieces/Song.js @@ -0,0 +1,25 @@ +export default { + view: function (vnode) { + const { song } = vnode.attrs + + return m("article.song", [ + m(".info", [ + m(".title", song.title), + m(".artist", song.artist), + ]), + m(".actions", [ + m( + "span.material-symbols-outlined.heart-icon", + { + class: song.favorite ? "is-favorite" : "", + onclick: () => song.toggleFavorite(), + title: song.favorite + ? "Als Favorit entfernen" + : "Als Favorit markieren", + }, + "favorite", + ), + ]), + ]) + }, +}