« get me outta code hell

content: generateCommentarySection: clear w/ dated first entry - 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-06-09 15:25:10 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-06-09 17:53:28 -0300
commit1294dd49f1c48fc39963602885fd7687d1a057d0 (patch)
treeeb5010795521170fc1da3ca5c48cec815a5ffc9b
parenta5c492ea35aac26f94ac7cf4d9af1ae28132ff74 (diff)
content: generateCommentarySection: clear w/ dated first entry
"Clear float" that is!
-rw-r--r--src/content/dependencies/generateCommentarySection.js15
-rw-r--r--src/static/css/site.css4
2 files changed, 17 insertions, 2 deletions
diff --git a/src/content/dependencies/generateCommentarySection.js b/src/content/dependencies/generateCommentarySection.js
index c7f6fa6a..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({
-          attributes: {id: 'artist-commentary'},
           title: language.$('misc.artistCommentary'),
+          attributes: [
+            {id: 'artist-commentary'},
+            data.firstEntryIsDated &&
+              {class: 'first-entry-is-dated'},
+          ],
         }),
 
       relations.entries,
diff --git a/src/static/css/site.css b/src/static/css/site.css
index a1c7509f..9d574bb5 100644
--- a/src/static/css/site.css
+++ b/src/static/css/site.css
@@ -1096,6 +1096,10 @@ ul.image-details li {
   content: " \00b7 ";
 }
 
+#artist-commentary.first-entry-is-dated {
+  clear: right;
+}
+
 .commentary-entry-heading {
   margin-left: 15px;
   padding-left: 5px;