« 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/dependencies/generateWikiHomeContentRow.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/generateWikiHomeContentRow.js')
-rw-r--r--src/content/dependencies/generateWikiHomeContentRow.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/content/dependencies/generateWikiHomeContentRow.js b/src/content/dependencies/generateWikiHomeContentRow.js
new file mode 100644
index 0000000..9062280
--- /dev/null
+++ b/src/content/dependencies/generateWikiHomeContentRow.js
@@ -0,0 +1,34 @@
+export default {
+  contentDependencies: ['generateColorStyleVariables'],
+  extraDependencies: ['html'],
+
+  relations(relation, row) {
+    return {
+      colorVariables:
+        relation('generateColorStyleVariables', row.color),
+    };
+  },
+
+  data(row) {
+    return {
+      name: row.name,
+    };
+  },
+
+  slots: {
+    content: {type: 'html'},
+  },
+
+  generate(data, relations, slots, {html}) {
+    return (
+      html.tag('section',
+        {
+          class: 'row',
+          style: [relations.colorVariables],
+        },
+        [
+          html.tag('h2', data.name),
+          slots.content,
+        ]));
+  },
+};