From e77262e34657164b5c194d2e639ff4ce627134a9 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 14 Aug 2024 13:03:39 -0300 Subject: content, css, client: inert previous/next links --- .../dependencies/generatePreviousNextLink.js | 51 +++++++++++++++------- 1 file changed, 36 insertions(+), 15 deletions(-) (limited to 'src/content') diff --git a/src/content/dependencies/generatePreviousNextLink.js b/src/content/dependencies/generatePreviousNextLink.js index 9fe04aed..1c1bf27c 100644 --- a/src/content/dependencies/generatePreviousNextLink.js +++ b/src/content/dependencies/generatePreviousNextLink.js @@ -15,21 +15,42 @@ export default { type: 'boolean', default: true, }, + + showWithoutLink: { + type: 'boolean', + default: true, + }, }, - generate: (slots, {html, language}) => - (html.isBlank(slots.link) || !slots.direction - ? html.blank() - : slots.link.slots({ - tooltipStyle: 'browser', - color: false, - - attributes: - (slots.id - ? {id: `${slots.direction}-button`} - : null), - - content: - language.$('misc.nav', slots.direction), - })), + generate(slots, {html, language}) { + if (!slots.direction) { + return html.blank(); + } + + const attributes = html.attributes(); + + if (slots.id) { + attributes.set('id', `${slots.direction}-button`); + } + + if (html.isBlank(slots.link)) { + if (slots.showWithoutLink) { + return ( + html.tag('a', {class: 'inert-previous-next-link'}, + attributes, + language.$('misc.nav', slots.direction))); + } else { + return html.blank(); + } + } + + return slots.link.slots({ + tooltipStyle: 'browser', + color: false, + attributes, + + content: + language.$('misc.nav', slots.direction), + }); + }, }; -- cgit 1.3.0-6-gf8a5