diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-10-02 19:07:03 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-02-25 20:03:24 -0400 |
commit | 3c8837b1fa330f1af1d5349d21b7699b8ac59c4a (patch) | |
tree | d6806daead6f90fb1fd1fb8448b52ed58b5d284f /src | |
parent | cebe2b942c96b17fcceccf22b498c377c9c81123 (diff) |
content: generateCoverGrid: add "classes" slot
Diffstat (limited to 'src')
-rw-r--r-- | src/content/dependencies/generateCoverGrid.js | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/content/dependencies/generateCoverGrid.js b/src/content/dependencies/generateCoverGrid.js index fa9b3dda..1898832f 100644 --- a/src/content/dependencies/generateCoverGrid.js +++ b/src/content/dependencies/generateCoverGrid.js @@ -16,6 +16,19 @@ export default { names: {validate: v => v.strictArrayOf(v.isHTML)}, info: {validate: v => v.strictArrayOf(v.isHTML)}, + // Differentiating from sparseArrayOf here - this list of classes should + // have the same length as the items above, i.e. nulls aren't going to be + // filtered out of it, but it is okay to *include* null (standing in for + // no classes for this grid item). + classes: { + validate: v => + v.strictArrayOf( + v.optional( + v.anyOf( + v.isArray, + v.isString))), + }, + lazy: {validate: v => v.anyOf(v.isWholeNumber, v.isBoolean)}, actionLinks: {validate: v => v.sparseArrayOf(v.isHTML)}, }, @@ -24,14 +37,23 @@ export default { return ( html.tag('div', {class: 'grid-listing'}, [ stitchArrays({ + classes: slots.classes, image: slots.images, link: slots.links, name: slots.names, info: slots.info, - }).map(({image, link, name, info}, index) => + }).map(({classes, image, link, name, info}, index) => link.slots({ - attributes: {class: ['grid-item', 'box']}, + attributes: [ + {class: ['grid-item', 'box']}, + + (classes + ? {class: classes} + : null), + ], + colorContext: 'image-box', + content: [ image.slots({ thumb: 'medium', |