« get me outta code hell

generatePreviousNextLink.js « dependencies « content « src - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generatePreviousNextLink.js
blob: 9fe04aed8947619cfd9954cae6064ae2c2b895c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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),
        })),
};