« get me outta code hell

content, client: memorable details, collapsed crediting/ref sources - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateCollapsedContentEntrySection.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-10-06 15:23:25 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-10-06 15:23:25 -0300
commit6a99486d361b1fb8af6be08cb9c1adbbcd0b0e8f (patch)
tree21e457e2a3b168c6e257c8f5209aef3be89ad508 /src/content/dependencies/generateCollapsedContentEntrySection.js
parentf820d83e94cf014e34857c69598261680c72329c (diff)
content, client: memorable details, collapsed crediting/ref sources preview
Diffstat (limited to 'src/content/dependencies/generateCollapsedContentEntrySection.js')
-rw-r--r--src/content/dependencies/generateCollapsedContentEntrySection.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/content/dependencies/generateCollapsedContentEntrySection.js b/src/content/dependencies/generateCollapsedContentEntrySection.js
new file mode 100644
index 00000000..ae3652c7
--- /dev/null
+++ b/src/content/dependencies/generateCollapsedContentEntrySection.js
@@ -0,0 +1,44 @@
+export default {
+  contentDependencies: [
+    'generateCommentaryEntry',
+    'generateContentContentHeading',
+  ],
+
+  extraDependencies: ['html'],
+
+  relations: (relation, entries, thing) => ({
+    contentContentHeading:
+      relation('generateContentContentHeading', thing),
+
+    entries:
+      entries
+        .map(entry => relation('generateCommentaryEntry', entry)),
+  }),
+
+  slots: {
+    id: {type: 'string'},
+    string: {type: 'string'},
+  },
+
+  generate: (relations, slots, {html}) =>
+    html.tag('details',
+      {[html.onlyIfContent]: true},
+
+      slots.id && [
+        {class: 'memorable'},
+        {'data-memorable-id': slots.id},
+      ],
+
+      [
+        relations.contentContentHeading.slots({
+          attributes: [
+            slots.id && {id: slots.id},
+          ],
+
+          string: slots.string,
+          summary: true,
+        }),
+
+        relations.entries,
+      ]),
+};