« get me outta code hell

generateAdditionalFilesList.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/generateAdditionalFilesList.js
blob: f504cf8017fddf25f631db0b6f74a92dd80d1561 (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
import {stitchArrays} from '#sugar';

export default {
  extraDependencies: ['html'],

  slots: {
    chunks: {
      validate: v => v.strictArrayOf(v.isHTML),
    },

    chunkItems: {
      validate: v => v.strictArrayOf(v.isHTML),
    },
  },

  generate: (slots, {html}) =>
    html.tag('ul', {class: 'additional-files-list'},
      stitchArrays({
        chunk: slots.chunks,
        items: slots.chunkItems,
      }).map(({chunk, items}) =>
          chunk.clone()
            .slot('items', items))),
};