« get me outta code hell

content: generateTooltip - 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-01-13 15:36:05 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-01-13 20:22:03 -0400
commit11dc3d3ef903b6ad5259d081c57b1c91c4616665 (patch)
tree96ab36c05df965854a6d46100341ea591b0551ae
parent42c9000389a114463447c6e0a18b77c408ef5388 (diff)
content: generateTooltip
-rw-r--r--src/content/dependencies/generateTooltip.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/content/dependencies/generateTooltip.js b/src/content/dependencies/generateTooltip.js
new file mode 100644
index 00000000..81f74aec
--- /dev/null
+++ b/src/content/dependencies/generateTooltip.js
@@ -0,0 +1,30 @@
+export default {
+  extraDependencies: ['html'],
+
+  slots: {
+    attributes: {
+      type: 'attributes',
+      mutable: false,
+    },
+
+    contentAttributes: {
+      type: 'attributes',
+      mutable: false,
+    },
+
+    content: {
+      type: 'html',
+      mutable: false,
+    },
+  },
+
+  generate: (slots, {html}) =>
+    html.tag('span', {class: 'tooltip'},
+      {[html.noEdgeWhitespace]: true},
+      slots.attributes,
+
+      html.tag('span', {class: 'tooltip-content'},
+        {[html.noEdgeWhitespace]: true},
+        slots.contentAttributes,
+        slots.content)),
+};