From 7cb88275fd3c813114271c0a136b12c72c5a172a Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 19 Nov 2024 13:25:22 -0400 Subject: content: decompose generateCoverArtwork No visual/site changes yet. This involves introducing an unfortunate mega-hack in generateStickyHeadingContainer, which sets slots on cover artworks. Very scary. Oooooo Otherwise, all cover artwork code is much more compositional. Pass-through slots (`image`) are removed in generateCoverArtwork and a partially-formed `image` slot is accepted instead. --- .../generateCoverArtworkArtistDetails.js | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/content/dependencies/generateCoverArtworkArtistDetails.js (limited to 'src/content/dependencies/generateCoverArtworkArtistDetails.js') diff --git a/src/content/dependencies/generateCoverArtworkArtistDetails.js b/src/content/dependencies/generateCoverArtworkArtistDetails.js new file mode 100644 index 00000000..5b235353 --- /dev/null +++ b/src/content/dependencies/generateCoverArtworkArtistDetails.js @@ -0,0 +1,23 @@ +export default { + contentDependencies: ['linkArtistGallery'], + extraDependencies: ['html', 'language'], + + relations: (relation, contributions) => ({ + artistLinks: + contributions + .map(contrib => contrib.artist) + .map(artist => + relation('linkArtistGallery', artist)), + }), + + generate: (relations, {html, language}) => + html.tag('p', {class: 'image-details'}, + {[html.onlyIfContent]: true}, + + {class: 'illustrator-details'}, + + language.$('misc.coverGrid.details.coverArtists', { + artists: + language.formatConjunctionList(relations.artistLinks), + })), +}; -- cgit 1.3.0-6-gf8a5