« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateAlbumTrackListItem.js5
-rw-r--r--src/content/dependencies/generateTrackList.js11
-rw-r--r--src/content/dependencies/generateTrackListItem.js10
3 files changed, 18 insertions, 8 deletions
diff --git a/src/content/dependencies/generateAlbumTrackListItem.js b/src/content/dependencies/generateAlbumTrackListItem.js
index a42dcb66..44297c15 100644
--- a/src/content/dependencies/generateAlbumTrackListItem.js
+++ b/src/content/dependencies/generateAlbumTrackListItem.js
@@ -54,6 +54,9 @@ export default {
           ? data.albumHasDuration
           : true),
 
-      color: data.colorize,
+      colorMode:
+        (data.colorize
+          ? 'line'
+          : 'none'),
     }),
 };
diff --git a/src/content/dependencies/generateTrackList.js b/src/content/dependencies/generateTrackList.js
index 19e2efeb..53a32536 100644
--- a/src/content/dependencies/generateTrackList.js
+++ b/src/content/dependencies/generateTrackList.js
@@ -8,7 +8,14 @@ export default {
         .map(track => relation('generateTrackListItem', track, [])),
   }),
 
-  generate: (relations, {html}) =>
+  slots: {
+    colorMode: {
+      validate: v => v.is('none', 'track', 'line'),
+      default: 'track',
+    },
+  },
+
+  generate: (relations, slots, {html}) =>
     html.tag('ul',
       {[html.onlyIfContent]: true},
 
@@ -16,6 +23,6 @@ export default {
         item.slots({
           showArtists: true,
           showDuration: false,
-          color: true,
+          colorMode: slots.colorMode,
         }))),
 };
diff --git a/src/content/dependencies/generateTrackListItem.js b/src/content/dependencies/generateTrackListItem.js
index 36e56717..887b6f03 100644
--- a/src/content/dependencies/generateTrackListItem.js
+++ b/src/content/dependencies/generateTrackListItem.js
@@ -50,16 +50,16 @@ export default {
       default: false,
     },
 
-    color: {
-      type: 'boolean',
-      default: true,
+    colorMode: {
+      validate: v => v.is('none', 'track', 'line'),
+      default: 'track',
     },
   },
 
   generate: (data, relations, slots, {html, language}) =>
     language.encapsulate('trackList.item', itemCapsule =>
       html.tag('li',
-        slots.color &&
+        slots.colorMode === 'line' &&
           relations.colorStyle.slot('context', 'primary-only'),
 
         language.encapsulate(itemCapsule, workingCapsule => {
@@ -67,7 +67,7 @@ export default {
 
           workingOptions.track =
             relations.trackLink
-              .slot('color', false);
+              .slot('color', slots.colorMode === 'track');
 
           if (slots.showDuration) {
             workingCapsule += '.withDuration';