diff options
Diffstat (limited to 'src/content/dependencies/generateCollapsedContentEntrySection.js')
-rw-r--r-- | src/content/dependencies/generateCollapsedContentEntrySection.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/content/dependencies/generateCollapsedContentEntrySection.js b/src/content/dependencies/generateCollapsedContentEntrySection.js new file mode 100644 index 00000000..ae3652c7 --- /dev/null +++ b/src/content/dependencies/generateCollapsedContentEntrySection.js @@ -0,0 +1,44 @@ +export default { + contentDependencies: [ + 'generateCommentaryEntry', + 'generateContentContentHeading', + ], + + extraDependencies: ['html'], + + relations: (relation, entries, thing) => ({ + contentContentHeading: + relation('generateContentContentHeading', thing), + + entries: + entries + .map(entry => relation('generateCommentaryEntry', entry)), + }), + + slots: { + id: {type: 'string'}, + string: {type: 'string'}, + }, + + generate: (relations, slots, {html}) => + html.tag('details', + {[html.onlyIfContent]: true}, + + slots.id && [ + {class: 'memorable'}, + {'data-memorable-id': slots.id}, + ], + + [ + relations.contentContentHeading.slots({ + attributes: [ + slots.id && {id: slots.id}, + ], + + string: slots.string, + summary: true, + }), + + relations.entries, + ]), +}; |