« get me outta code hell

generateAdditionalNamesBox.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/generateAdditionalNamesBox.js
blob: 4f92580ded5a72bcf38db25d2e1ad78f4f2007b3 (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
export default {
  contentDependencies: ['generateAdditionalNamesBoxItem'],
  extraDependencies: ['html', 'language'],

  relations: (relation, additionalNames) => ({
    items:
      additionalNames
        .map(entry => relation('generateAdditionalNamesBoxItem', entry)),
  }),

  generate: (relations, {html, language}) =>
    html.tag('div', {id: 'additional-names-box'},
      {[html.onlyIfContent]: true},

      [
        html.tag('p',
          {[html.onlyIfSiblings]: true},

          language.$('misc.additionalNames.title')),

        html.tag('ul',
          {[html.onlyIfContent]: true},

          relations.items
            .map(item => html.tag('li', item))),
      ]),
};