« get me outta code hell

content: cover-artwork, cover-art-column - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateCoverArtwork.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-03-31 17:43:33 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-04-10 16:02:36 -0300
commit05c3b2ad399081cac88c8ac7fddf233c01d79e98 (patch)
tree02b05c6247fbe6122b457985abc5de7e491a4ed2 /src/content/dependencies/generateCoverArtwork.js
parent015989924eadd401ae5932d634109a2f6b801666 (diff)
content: cover-artwork, cover-art-column
Diffstat (limited to 'src/content/dependencies/generateCoverArtwork.js')
-rw-r--r--src/content/dependencies/generateCoverArtwork.js82
1 files changed, 38 insertions, 44 deletions
diff --git a/src/content/dependencies/generateCoverArtwork.js b/src/content/dependencies/generateCoverArtwork.js
index 06972d6b..58c29830 100644
--- a/src/content/dependencies/generateCoverArtwork.js
+++ b/src/content/dependencies/generateCoverArtwork.js
@@ -38,49 +38,43 @@ export default {
         ? {square: true}
         : {dimensions: slots.dimensions});
 
-    switch (slots.mode) {
-      case 'primary':
-        return html.tags([
-          slots.image.slots({
-            thumb: 'medium',
-            reveal: true,
-            link: true,
-
-            warnings: slots.warnings,
-            ...sizeSlots,
-          }),
-
-          slots.details,
-        ]);
-
-      case 'thumbnail':
-        return (
-          slots.image.slots({
-            thumb: 'small',
-            reveal: false,
-            link: false,
-
-            warnings: slots.warnings,
-            ...sizeSlots,
-          }));
-
-      case 'commentary':
-        return (
-          slots.image.slots({
-            thumb: 'medium',
-            reveal: true,
-            link: true,
-            lazy: true,
-
-            warnings: slots.warnings,
-            ...sizeSlots,
-
-            attributes:
-              {class: 'commentary-art'},
-          }));
-
-      default:
-        return html.blank();
-    }
+    return (
+      html.tag('div', {class: 'cover-artwork'},
+        slots.mode === 'commentary' &&
+          {class: 'commentary-art'},
+
+        (slots.mode === 'primary'
+          ? [
+              slots.image.slots({
+                thumb: 'medium',
+                reveal: true,
+                link: true,
+
+                warnings: slots.warnings,
+                ...sizeSlots,
+              }),
+
+              slots.details,
+            ]
+       : slots.mode === 'thumbnail'
+          ? slots.image.slots({
+              thumb: 'small',
+              reveal: false,
+              link: false,
+
+              warnings: slots.warnings,
+              ...sizeSlots,
+            })
+       : slots.mode === 'commentary'
+          ? slots.image.slots({
+              thumb: 'medium',
+              reveal: true,
+              link: true,
+              lazy: true,
+
+              warnings: slots.warnings,
+              ...sizeSlots,
+            })
+          : html.blank())));
   },
 };