From 7c5939aefafc88201eb73ba67a35d4de77c94d7a Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 19 Oct 2024 21:46:14 -0300 Subject: content: generateGroupNavAccent (dots) --- src/content/dependencies/generateGroupNavAccent.js | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/content/dependencies/generateGroupNavAccent.js (limited to 'src/content/dependencies/generateGroupNavAccent.js') diff --git a/src/content/dependencies/generateGroupNavAccent.js b/src/content/dependencies/generateGroupNavAccent.js new file mode 100644 index 00000000..0e4ebe8a --- /dev/null +++ b/src/content/dependencies/generateGroupNavAccent.js @@ -0,0 +1,53 @@ +import {empty} from '#sugar'; + +export default { + contentDependencies: [ + 'generateInterpageDotSwitcher', + 'linkGroup', + 'linkGroupGallery', + ], + + extraDependencies: ['html', 'language'], + + relations: (relation, group) => ({ + switcher: + relation('generateInterpageDotSwitcher'), + + infoLink: + relation('linkGroup', group), + + galleryLink: + (empty(group.albums) + ? null + : relation('linkGroupGallery', group)), + }), + + slots: { + currentExtra: { + validate: v => v.is('gallery'), + }, + }, + + generate: (relations, slots, {language}) => + relations.switcher.slots({ + links: [ + relations.infoLink.slots({ + attributes: [ + slots.currentExtra === null && + {class: 'current'}, + ], + + content: language.$('misc.nav.info'), + }), + + relations.galleryLink?.slots({ + attributes: [ + slots.currentExtra === 'gallery' && + {class: 'current'}, + ], + + content: language.$('misc.nav.gallery'), + }), + ], + }), +}; -- cgit 1.3.0-6-gf8a5