« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content
diff options
context:
space:
mode:
Diffstat (limited to 'src/content')
-rw-r--r--src/content/dependencies/generateBanner.js25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/content/dependencies/generateBanner.js b/src/content/dependencies/generateBanner.js
index 835140a8..15eb08eb 100644
--- a/src/content/dependencies/generateBanner.js
+++ b/src/content/dependencies/generateBanner.js
@@ -15,14 +15,19 @@ export default {
     },
   },
 
-  generate(slots, {html, to}) {
-    return (
-      html.tag('div', {id: 'banner'},
-        html.tag('img', {
-          src: to(...slots.path),
-          alt: slots.alt,
-          width: slots.dimensions?.[0] ?? 1100,
-          height: slots.dimensions?.[1] ?? 200,
-        })));
-  },
+  generate: (slots, {html, to}) =>
+    html.tag('div', {id: 'banner'},
+      html.tag('img',
+        {src: to(...slots.path)},
+
+        (slots.dimensions
+          ? {width: slots.dimensions[0]}
+          : {width: 1100}),
+
+        (slots.dimensions
+          ? {height: slots.dimensions[1]}
+          : {height: 200}),
+
+        slots.alt &&
+          {alt: slots.alt})),
 };