« get me outta code hell

content: image-box color context - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-01-01 00:19:42 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-01-01 15:34:01 -0400
commit86418c8f864fcd251589440c69ec99c6ea58ae70 (patch)
tree7b46631bf297b21f25f38e5b0fb6a9a6ee4b0e82 /src
parentfc46f002300a5cec8deec2ec404dcfc29c2e8d63 (diff)
content: image-box color context
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateColorStyleAttribute.js1
-rw-r--r--src/content/dependencies/generateColorStyleVariables.js8
-rw-r--r--src/content/dependencies/generateCoverGrid.js1
-rw-r--r--src/content/dependencies/image.js5
-rw-r--r--src/content/dependencies/linkThing.js8
5 files changed, 22 insertions, 1 deletions
diff --git a/src/content/dependencies/generateColorStyleAttribute.js b/src/content/dependencies/generateColorStyleAttribute.js
index b1901616..03d95ac5 100644
--- a/src/content/dependencies/generateColorStyleAttribute.js
+++ b/src/content/dependencies/generateColorStyleAttribute.js
@@ -20,6 +20,7 @@ export default {
     context: {
       validate: v => v.is(
         'any-content',
+        'image-box',
         'primary-only'),
 
       default: 'any-content',
diff --git a/src/content/dependencies/generateColorStyleVariables.js b/src/content/dependencies/generateColorStyleVariables.js
index 7cd04bd1..d1c121fe 100644
--- a/src/content/dependencies/generateColorStyleVariables.js
+++ b/src/content/dependencies/generateColorStyleVariables.js
@@ -9,6 +9,7 @@ export default {
     context: {
       validate: v => v.is(
         'any-content',
+        'image-box',
         'page-root',
         'primary-only'),
 
@@ -51,6 +52,13 @@ export default {
         selectedProperties = anyContent;
         break;
 
+      case 'image-box':
+        selectedProperties = [
+          `--primary-color: ${primary}`,
+          `--dim-color: ${dim}`,
+        ];
+        break;
+
       case 'page-root':
         selectedProperties = [
           ...anyContent,
diff --git a/src/content/dependencies/generateCoverGrid.js b/src/content/dependencies/generateCoverGrid.js
index 5636e4f3..e2212b70 100644
--- a/src/content/dependencies/generateCoverGrid.js
+++ b/src/content/dependencies/generateCoverGrid.js
@@ -31,6 +31,7 @@ export default {
         }).map(({image, link, name, info}, index) =>
             link.slots({
               attributes: {class: ['grid-item', 'box']},
+              colorContext: 'image-box',
               content: [
                 image.slots({
                   thumb: 'medium',
diff --git a/src/content/dependencies/image.js b/src/content/dependencies/image.js
index bc3cc173..fb4b59b6 100644
--- a/src/content/dependencies/image.js
+++ b/src/content/dependencies/image.js
@@ -158,7 +158,10 @@ export default {
 
     if (slots.color) {
       const colorStyle =
-        relations.colorStyle.slot('color', slots.color);
+        relations.colorStyle.slots({
+          color: slots.color,
+          context: 'image-box',
+        });
 
       if (willLink) {
         linkAttributes.add(colorStyle);
diff --git a/src/content/dependencies/linkThing.js b/src/content/dependencies/linkThing.js
index 320368a8..60fcc3ef 100644
--- a/src/content/dependencies/linkThing.js
+++ b/src/content/dependencies/linkThing.js
@@ -36,6 +36,7 @@ export default {
 
     colorContext: {
       validate: v => v.is(
+        'image-box',
         'primary-only'),
 
       default: 'primary-only',
@@ -81,6 +82,13 @@ export default {
       let selectColors;
 
       switch (slots.colorContext) {
+        case 'image-box':
+          selectColors = {
+            '--primary-color': 'primary',
+            '--dim-color': 'dim',
+          };
+          break;
+
         case 'primary-only':
           selectColors = {
             '--primary-color': 'primary',