diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-08-02 12:45:30 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-08-02 12:45:30 -0300 |
commit | 00644623eb6c99a33b3b08771f4f23841f747b88 (patch) | |
tree | effb4db5cb5a317adc56614484180552c447cc70 /src/content/dependencies/generateAlbumCommentaryPage.js | |
parent | c699396105f5aaa2380ab3dee282e1f99f7055fb (diff) |
content: pass color directly through slots in various places
Primarily through generateColorStyle{Rules,Variables}, the former of which is also refactored into generatePageLayout, which now takes a direct color slot itself as well.
Diffstat (limited to 'src/content/dependencies/generateAlbumCommentaryPage.js')
-rw-r--r-- | src/content/dependencies/generateAlbumCommentaryPage.js | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/content/dependencies/generateAlbumCommentaryPage.js b/src/content/dependencies/generateAlbumCommentaryPage.js index ea31292..2eeedad 100644 --- a/src/content/dependencies/generateAlbumCommentaryPage.js +++ b/src/content/dependencies/generateAlbumCommentaryPage.js @@ -4,7 +4,6 @@ export default { contentDependencies: [ 'generateAlbumNavAccent', 'generateAlbumStyleRules', - 'generateColorStyleRules', 'generateColorStyleVariables', 'generateContentHeading', 'generatePageLayout', @@ -24,9 +23,6 @@ export default { relations.albumStyleRules = relation('generateAlbumStyleRules', album); - relations.colorStyleRules = - relation('generateColorStyleRules', album.color); - relations.albumLink = relation('linkAlbum', album); @@ -59,7 +55,7 @@ export default { .map(track => (track.color === album.color ? null - : relation('generateColorStyleVariables', track.color))); + : relation('generateColorStyleVariables'))); return relations; }, @@ -68,6 +64,7 @@ export default { const data = {}; data.name = album.name; + data.color = album.color; const tracksWithCommentary = album.tracks @@ -91,6 +88,13 @@ export default { tracksWithCommentary .map(track => track.directory); + data.trackCommentaryColors = + tracksWithCommentary + .map(track => + (track.color === album.color + ? null + : track.color)); + return data; }, @@ -104,8 +108,8 @@ export default { headingMode: 'sticky', - colorStyleRules: [relations.colorStyleRules], - additionalStyleRules: [relations.albumStyleRules], + color: data.color, + styleRules: [relations.albumStyleRules], mainClasses: ['long-content'], mainContent: [ @@ -135,13 +139,18 @@ export default { directory: data.trackCommentaryDirectories, content: relations.trackCommentaryContent, colorVariables: relations.trackCommentaryColorVariables, - }).map(({heading, link, directory, content, colorVariables}) => [ + color: data.trackCommentaryColors, + }).map(({heading, link, directory, content, colorVariables, color}) => [ heading.slots({ tag: 'h3', id: directory, title: link, }), - html.tag('blockquote', {style: colorVariables}, content), + html.tag('blockquote', + (color + ? {style: colorVariables.slot('color', color).content} + : {}), + content), ]), ], |