diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-04-03 17:13:58 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-04-03 17:20:55 -0300 |
commit | ea2ed15a28290a4d211b39a78cef2e2c68eaffe4 (patch) | |
tree | 9976475eb7019db1fd439efba9267ac395fe9f96 /src/content/dependencies/generateFlashActSidebarCurrentActBox.js | |
parent | 635c54d883e2f6e8ea1fbae09a305667335924ea (diff) |
content: generateFlashActSidebar{CurrentAct,SideMap}Box
Diffstat (limited to 'src/content/dependencies/generateFlashActSidebarCurrentActBox.js')
-rw-r--r-- | src/content/dependencies/generateFlashActSidebarCurrentActBox.js | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/content/dependencies/generateFlashActSidebarCurrentActBox.js b/src/content/dependencies/generateFlashActSidebarCurrentActBox.js new file mode 100644 index 00000000..c5426a41 --- /dev/null +++ b/src/content/dependencies/generateFlashActSidebarCurrentActBox.js @@ -0,0 +1,63 @@ +export default { + contentDependencies: [ + 'generatePageSidebarBox', + 'linkFlash', + 'linkFlashAct', + ], + + extraDependencies: ['html', 'language'], + + relations: (relation, act, _flash) => ({ + box: + relation('generatePageSidebarBox'), + + actLink: + relation('linkFlashAct', act), + + flashLinks: + act.flashes + .map(flash => relation('linkFlash', flash)), + }), + + data: (act, flash) => ({ + isFlashActPage: + !flash, + + currentFlashIndex: + act.flashes.indexOf(flash), + + customListTerminology: + act.listTerminology, + }), + + generate: (data, relations, {html, language}) => + relations.box.slots({ + attributes: {class: 'flash-act-map-sidebar-box'}, + + content: [ + html.tag('h1', relations.actLink), + + html.tag('details', + (data.isFlashActPage + ? {} + : {class: 'current', open: true}), + + [ + html.tag('summary', + html.tag('span', {class: 'group-name'}, + (data.customListTerminology + ? language.sanitize(data.customListTerminology) + : language.$('flashSidebar.flashList.entriesInThisSection')))), + + html.tag('ul', + relations.flashLinks + .map((flashLink, index) => + html.tag('li', + index === data.currentFlashIndex && + {class: 'current'}, + + flashLink))), + ]), + ], + }), +}; |