diff options
Diffstat (limited to 'src/content/dependencies/generatePreviousNextLink.js')
-rw-r--r-- | src/content/dependencies/generatePreviousNextLink.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/content/dependencies/generatePreviousNextLink.js b/src/content/dependencies/generatePreviousNextLink.js new file mode 100644 index 00000000..9fe04aed --- /dev/null +++ b/src/content/dependencies/generatePreviousNextLink.js @@ -0,0 +1,35 @@ +export default { + extraDependencies: ['html', 'language'], + + slots: { + link: { + type: 'html', + mutable: true, + }, + + direction: { + validate: v => v.is('previous', 'next'), + }, + + id: { + 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), + })), +}; |