« get me outta code hell

wip - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateLyricsSection.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-07-25 16:35:02 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-04-13 22:54:14 -0300
commit48dde4a388fd4c31dd5680f7535419874124e554 (patch)
tree50c0fce8ef19f3bae856e79b1dc92e257e0db4ab /src/content/dependencies/generateLyricsSection.js
parentb1ff1444c47f6bd8c532e3a76eb2a5b92ed82a0e (diff)
wip
Diffstat (limited to 'src/content/dependencies/generateLyricsSection.js')
-rw-r--r--src/content/dependencies/generateLyricsSection.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/content/dependencies/generateLyricsSection.js b/src/content/dependencies/generateLyricsSection.js
new file mode 100644
index 00000000..7e7718c7
--- /dev/null
+++ b/src/content/dependencies/generateLyricsSection.js
@@ -0,0 +1,42 @@
+export default {
+  contentDependencies: [
+    'generateContentHeading',
+    'generateLyricsEntry',
+    'generateLyricsSwitcher',
+    'transformContent',
+  ],
+
+  extraDependencies: ['html', 'language'],
+
+  relations: (relation, entries) => ({
+    heading:
+      relation('generateContentHeading'),
+
+    switcher:
+      relation('generateLyricsSwitcher', entries),
+
+    entries:
+      entries
+        .map(entry => relation('generateLyricsEntry', entry)),
+  }),
+
+  generate: (relations, {html, language}) =>
+    html.tags([
+      relations.heading
+        .slots({
+          attributes: {id: 'lyrics'},
+          title: language.$('releaseInfo.lyrics'),
+        }),
+
+      relations.switcher,
+
+      relations.entries
+        .map((entry, index) =>
+          entry.slots({
+            attributes: [
+              index >= 1 &&
+                {style: 'display: none'},
+            ],
+          })),
+    ]),
+};