From 6a99486d361b1fb8af6be08cb9c1adbbcd0b0e8f Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 6 Oct 2025 15:23:25 -0300 Subject: content, client: memorable details, collapsed crediting/ref sources --- .../generateCollapsedContentEntrySection.js | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/content/dependencies/generateCollapsedContentEntrySection.js (limited to 'src/content/dependencies/generateCollapsedContentEntrySection.js') 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, + ]), +}; -- cgit 1.3.0-6-gf8a5