From 7af82c0c009d2f2aeb6b242b5ee1bafdee4ffc95 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 19 Oct 2024 20:56:00 -0300 Subject: content: generateDotSwitcherTemplate: various dynamics fixes --- .../dependencies/generateDotSwitcherTemplate.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/content/dependencies') diff --git a/src/content/dependencies/generateDotSwitcherTemplate.js b/src/content/dependencies/generateDotSwitcherTemplate.js index 6d350b22..745a1471 100644 --- a/src/content/dependencies/generateDotSwitcherTemplate.js +++ b/src/content/dependencies/generateDotSwitcherTemplate.js @@ -1,5 +1,5 @@ export default { - extraDependencies: ['html', 'language'], + extraDependencies: ['html'], slots: { attributes: { @@ -14,16 +14,20 @@ export default { initialOptionIndex: {type: 'number'}, }, - generate: (slots, {html, language}) => + generate: (slots, {html}) => html.tag('span', {class: 'dot-switcher'}, + {[html.noEdgeWhitespace]: true}, + {[html.joinChildren]: ''}, + slots.attributes, - language.formatListWithoutSeparator( - slots.options - .map((option, index) => - html.tag('span', - index === slots.initialOptionIndex && - {class: 'current'}, + slots.options + .map((option, index) => + html.tag('span', + {[html.onlyIfContent]: true}, + + index === slots.initialOptionIndex && + {class: 'current'}, - option)))), + option))), }; -- cgit 1.3.0-6-gf8a5