« 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/generateCommentarySection.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/generateCommentarySection.js')
-rw-r--r--src/content/dependencies/generateCommentarySection.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/content/dependencies/generateCommentarySection.js b/src/content/dependencies/generateCommentarySection.js
index 8ae1b2d0..39727360 100644
--- a/src/content/dependencies/generateCommentarySection.js
+++ b/src/content/dependencies/generateCommentarySection.js
@@ -16,12 +16,23 @@ export default {
         relation('generateCommentaryEntry', entry)),
   }),
 
-  generate: (relations, {html, language}) =>
+  data: (entries) => ({
+    firstEntryIsDated:
+      (entries[0]
+        ? !!entries[0].date
+        : null),
+  }),
+
+  generate: (data, relations, {html, language}) =>
     html.tags([
       relations.heading
         .slots({
-          id: 'artist-commentary',
-          title: language.$('misc.artistCommentary')
+          title: language.$('misc.artistCommentary'),
+          attributes: [
+            {id: 'artist-commentary'},
+            data.firstEntryIsDated &&
+              {class: 'first-entry-is-dated'},
+          ],
         }),
 
       relations.entries,