« get me outta code hell

content: generateInterpageDotSwitcher (stub) - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-10-15 23:17:20 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-11-02 22:12:48 -0300
commitb657f641c89ceee7676dc6d29fe4b9a168a97266 (patch)
tree6b634ecd2be60dbcae4c88dcd9168764bb263bf6
parent8c1df54b8b170adf81ffc2bfb5d49704b229647f (diff)
content: generateInterpageDotSwitcher (stub)
Not used anywhere for the time being
-rw-r--r--src/content/dependencies/generateInterpageDotSwitcher.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/content/dependencies/generateInterpageDotSwitcher.js b/src/content/dependencies/generateInterpageDotSwitcher.js
new file mode 100644
index 00000000..5a33444e
--- /dev/null
+++ b/src/content/dependencies/generateInterpageDotSwitcher.js
@@ -0,0 +1,31 @@
+export default {
+  contentDependencies: ['generateDotSwitcherTemplate'],
+  extraDependencies: ['html', 'language'],
+
+  relations: (relation) => ({
+    template:
+      relation('generateDotSwitcherTemplate'),
+  }),
+
+  slots: {
+    attributes: {
+      type: 'attributes',
+      mutable: false,
+    },
+
+    links: {
+      validate: v => v.strictArrayOf(v.isHTML),
+    },
+  },
+
+  generate: (relations, slots) =>
+    relations.template.slots({
+      attributes: [
+        {class: 'interpage'},
+        slots.attributes,
+      ],
+
+      // TODO: Do something to set a class on a link to the current page??
+      options: slots.links,
+    }),
+};