diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-07-01 14:14:38 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-07-01 14:14:38 -0300 |
commit | 34a1115df603aff44f354abe9f15d24d53f7a5ac (patch) | |
tree | 09726c8bbfff8c2eec2c189a18841a10827e1ff5 /src/content/dependencies/generateListingPage.js | |
parent | 28514381d7c4639608786151dc94e5a1b22f85fe (diff) |
content: avoid boilerplate around listings, make spec relevant again
Diffstat (limited to 'src/content/dependencies/generateListingPage.js')
-rw-r--r-- | src/content/dependencies/generateListingPage.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/content/dependencies/generateListingPage.js b/src/content/dependencies/generateListingPage.js index ae186d28..6e9db689 100644 --- a/src/content/dependencies/generateListingPage.js +++ b/src/content/dependencies/generateListingPage.js @@ -9,28 +9,33 @@ export default { }; }, - slots: { - title: {type: 'string'}, + data(query, sprawl, listing) { + return { + stringsKey: listing.stringsKey, + }; + }, + slots: { type: { validate: v => v.is('rows'), }, rows: { - validate: v => v.arrayOf(v.isHTML), + validate: v => v.arrayOf(v.isObject), }, }, - generate(relations, slots, {html}) { + generate(data, relations, slots, {html}) { return relations.layout.slots({ - title: slots.title, + title: language.$(`listingPage.${data.stringsKey}.title`), headingMode: 'sticky', mainContent: [ slots.type === 'rows' && html.tag('ul', - slots.rows - .map(row => html.tag('li', row))), + slots.rows.map(row => + html.tag('li', + language.$(`listingPage.${data.stringsKey}.item`, row)))), ], navLinkStyle: 'hierarchical', |