diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-11-09 15:48:36 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-11-09 15:48:36 -0400 |
commit | 443c2e42ad2731e63f40c9575e2c27001ed55bae (patch) | |
tree | a1d6964eba172d7725ab1319eb26954561ffdca5 /src/content/dependencies/generateListingPage.js | |
parent | 150c414044662134ddf785e7411560e3a6051a03 (diff) |
content: generateListingPage: add chunkRowAttributes slot
This refactors out the hard-coded 'rerelease' behavior.
Diffstat (limited to 'src/content/dependencies/generateListingPage.js')
-rw-r--r-- | src/content/dependencies/generateListingPage.js | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/content/dependencies/generateListingPage.js b/src/content/dependencies/generateListingPage.js index 45b7dc1b..403f891f 100644 --- a/src/content/dependencies/generateListingPage.js +++ b/src/content/dependencies/generateListingPage.js @@ -68,6 +68,7 @@ export default { chunkTitles: {validate: v => v.strictArrayOf(v.isObject)}, chunkRows: {validate: v => v.strictArrayOf(v.isObject)}, + chunkRowAttributes: {validate: v => v.strictArrayOf(v.optional(v.isObject))}, showSkipToSection: {type: 'boolean', default: false}, chunkIDs: {validate: v => v.strictArrayOf(v.isString)}, @@ -165,9 +166,17 @@ export default { stitchArrays({ title: slots.chunkTitles, - rows: slots.chunkRows, id: slots.chunkIDs, - }).map(({title, rows, id}) => [ + + rows: slots.chunkRows, + rowAttributes: slots.chunkRowAttributes, + }).map(({ + title, + id, + + rows, + rowAttributes, + }) => [ relations.chunkHeading .clone() .slots({ @@ -178,10 +187,13 @@ export default { html.tag('dd', html.tag(listTag, - rows.map(row => - html.tag('li', - {class: row.stringsKey === 'rerelease' && 'rerelease'}, - formatListingString('chunk.item', row))))), + stitchArrays({ + row: rows, + attributes: rowAttributes ?? rows.map(() => null), + }).map(({row, attributes}) => + html.tag('li', + attributes, + formatListingString('chunk.item', row))))), ]), ]), ], |