diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-04-08 16:54:39 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-04-08 16:54:39 -0300 |
commit | 776abf8d697716902692f357c6f179c1e681369f (patch) | |
tree | a75e7f63ffc13121c3c08f1f78c10bc883b4d4e1 /src/content/dependencies/generateCoverArtwork.js | |
parent | 0cbfa8c1b70080c7ec4eb352902cf76f8ef30fcf (diff) |
html: drastically simplify template/slot system
Diffstat (limited to 'src/content/dependencies/generateCoverArtwork.js')
-rw-r--r-- | src/content/dependencies/generateCoverArtwork.js | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/src/content/dependencies/generateCoverArtwork.js b/src/content/dependencies/generateCoverArtwork.js index 62fc3566..2d18fed3 100644 --- a/src/content/dependencies/generateCoverArtwork.js +++ b/src/content/dependencies/generateCoverArtwork.js @@ -23,21 +23,38 @@ export default { }, generate(relations, {html, language}) { - return html.template(slot => - html.tag('div', {id: 'cover-art-container'}, [ - relations.image - .slot('path', slot('path')) - .slot('alt', slot('alt')) - .slot('thumb', 'medium') - .slot('id', 'cover-art') - .slot('link', true) - .slot('square', true), - - !empty(relations.tagLinks) && - html.tag('p', - language.$('releaseInfo.artTags.inline', { - tags: language.formatUnitList(relations.tagLinks), - })), - ])); + return html.template({ + annotation: 'generateCoverArtwork', + + slots: { + path: { + validate: v => v.validateArrayItems(v.isString), + }, + + alt: { + type: 'string', + }, + }, + + content(slots) { + return html.tag('div', {id: 'cover-art-container'}, [ + relations.image + .slots({ + path: slots.path, + alt: slots.alt, + thumb: 'medium', + id: 'cover-art', + link: true, + square: true, + }), + + !empty(relations.tagLinks) && + html.tag('p', + language.$('releaseInfo.artTags.inline', { + tags: language.formatUnitList(relations.tagLinks), + })), + ]); + }, + }); }, }; |