« get me outta code hell

content: generateWikiHomepage{*}: general expression cleanup - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateGridActionLinks.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-02-11 10:08:54 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-02-12 07:43:58 -0400
commit6d691b3e99c67c07f53e368f376c24c8944233b8 (patch)
treee25f9159cd01fe076f401321ccb7ce17e58d9f15 /src/content/dependencies/generateGridActionLinks.js
parentbdef19f601a11c25e8d58b56d7f8135a94722505 (diff)
content: generateWikiHomepage{*}: general expression cleanup
Diffstat (limited to 'src/content/dependencies/generateGridActionLinks.js')
-rw-r--r--src/content/dependencies/generateGridActionLinks.js20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/content/dependencies/generateGridActionLinks.js b/src/content/dependencies/generateGridActionLinks.js
index f5b1aaa6..585a02b9 100644
--- a/src/content/dependencies/generateGridActionLinks.js
+++ b/src/content/dependencies/generateGridActionLinks.js
@@ -1,5 +1,3 @@
-import {empty} from '#sugar';
-
 export default {
   extraDependencies: ['html'],
 
@@ -7,16 +5,12 @@ export default {
     actionLinks: {validate: v => v.sparseArrayOf(v.isHTML)},
   },
 
-  generate(slots, {html}) {
-    if (empty(slots.actionLinks)) {
-      return html.blank();
-    }
+  generate: (slots, {html}) =>
+    html.tag('div', {class: 'grid-actions'},
+      {[html.onlyIfContent]: true},
 
-    return (
-      html.tag('div', {class: 'grid-actions'},
-        slots.actionLinks
-          .filter(Boolean)
-          .map(link => link
-            .slot('attributes', {class: ['grid-item', 'box']}))));
-  },
+      (slots.actionLinks ?? [])
+        .filter(link => link && !html.isBlank(link))
+        .map(link => link
+          .slot('attributes', {class: ['grid-item', 'box']}))),
 };