« get me outta code hell

content, css: flatten .reveal into .image-container - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/image.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-01-13 17:12:57 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-01-13 17:12:57 -0400
commit1d3eac688b0d800323a1db9fcaf598005f50051a (patch)
treeef7bc88125f582c985681d3f0d9bc40a72258b3b /src/content/dependencies/image.js
parentafd52b5db6436e86eefd8a1c090e1e656ca35c6a (diff)
content, css: flatten .reveal into .image-container
Diffstat (limited to 'src/content/dependencies/image.js')
-rw-r--r--src/content/dependencies/image.js43
1 files changed, 23 insertions, 20 deletions
diff --git a/src/content/dependencies/image.js b/src/content/dependencies/image.js
index bc52321..a39acca 100644
--- a/src/content/dependencies/image.js
+++ b/src/content/dependencies/image.js
@@ -136,12 +136,17 @@ export default {
       slots.height && {height: slots.height},
     ]);
 
-    if (!originalSrc || isMissingImageFile) {
-      return prepare(
-        html.tag('div', {class: 'image-text-area'},
-          (html.isBlank(slots.missingSourceContent)
-            ? language.$('misc.missingImage')
-            : slots.missingSourceContent)));
+    const isPlaceholder =
+      !originalSrc || isMissingImageFile;
+
+    if (isPlaceholder) {
+      return (
+        prepare(
+          html.tag('div', {class: 'image-text-area'},
+            (html.isBlank(slots.missingSourceContent)
+              ? language.$('misc.missingImage')
+              : slots.missingSourceContent)),
+          'visible'));
     }
 
     let reveal = null;
@@ -314,15 +319,6 @@ export default {
         html.tag('div', {class: 'image-outer-area'},
           wrapped);
 
-      if (willReveal) {
-        wrapped =
-          html.tag('div', {class: 'reveal'},
-            images.revealStatic &&
-              {class: 'has-reveal-thumbnail'},
-
-            wrapped);
-      }
-
       if (willSquare) {
         wrapped =
           html.tag('div', {class: 'square-content'},
@@ -331,17 +327,24 @@ export default {
 
       wrapped =
         html.tag('div', {class: 'image-container'},
-          willLink &&
-            {class: 'has-link'},
-
           willSquare &&
             {class: 'square'},
 
           typeof slots.link === 'string' &&
             {class: 'no-image-preview'},
 
-          !originalSrc &&
-            {class: 'placeholder-image'},
+          (isPlaceholder
+            ? {class: 'placeholder-image'}
+            : [
+                willLink &&
+                  {class: 'has-link'},
+
+                willReveal &&
+                  {class: 'reveal'},
+
+                revealSrc &&
+                  {class: 'has-reveal-thumbnail'},
+              ]),
 
           visibility === 'hidden' &&
             {class: 'js-hide'},