« get me outta code hell

content, css: chronology links subgrid - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-06-18 11:14:49 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-06-18 22:56:16 -0300
commit29f4c5b571e960e6410f1555324a2d909bda8b2f (patch)
treeb2c3b2a2e6e479f00a8071c13454bac952ea5888 /src/content
parent1beb7246b1330ed6b3993c117ae81cf947c92a06 (diff)
content, css: chronology links subgrid
Diffstat (limited to 'src/content')
-rw-r--r--src/content/dependencies/generateContributionTooltipChronologySection.js46
1 files changed, 31 insertions, 15 deletions
diff --git a/src/content/dependencies/generateContributionTooltipChronologySection.js b/src/content/dependencies/generateContributionTooltipChronologySection.js
index 49e5d783..09f409f5 100644
--- a/src/content/dependencies/generateContributionTooltipChronologySection.js
+++ b/src/content/dependencies/generateContributionTooltipChronologySection.js
@@ -28,25 +28,41 @@ export default {
         : null),
   }),
 
-  generate: (relations, {html, language}) =>
-    language.encapsulate('misc.artistLink.chronology', capsule =>
-      html.tags([
-        html.tag('span', {class: 'chronology-link'},
-          {[html.onlyIfContent]: true},
+  data: (query, _contribution) => ({
+    previousName:
+      (query.previous
+        ? query.previous.thing.name
+        : null),
 
-          language.$(capsule, 'previous', {
-            [language.onlyIfOptions]: ['thing'],
+    nextName:
+      (query.next
+        ? query.next.thing.name
+        : null),
+  }),
 
-            thing: relations.previousLink,
-          })),
+  generate: (data, relations, {html, language}) =>
+    language.encapsulate('misc.artistLink', capsule =>
+      html.tags([
+        relations.previousLink?.slots({
+          attributes: {class: 'chronology-link'},
+          content: [
+            html.tag('span', {class: 'chronology-symbol'},
+              language.$(capsule, 'previousSymbol')),
 
-        html.tag('span', {class: 'chronology-link'},
-          {[html.onlyIfContent]: true},
+            html.tag('span', {class: 'chronology-text'},
+              language.sanitize(data.previousName)),
+          ],
+        }),
 
-          language.$(capsule, 'next', {
-            [language.onlyIfOptions]: ['thing'],
+        relations.nextLink?.slots({
+          attributes: {class: 'chronology-link'},
+          content: [
+            html.tag('span', {class: 'chronology-symbol'},
+              language.$(capsule, 'nextSymbol')),
 
-            thing: relations.nextLink,
-          })),
+            html.tag('span', {class: 'chronology-text'},
+              language.sanitize(data.nextName)),
+          ],
+        }),
       ])),
 };