« get me outta code hell

generateGridActionLinks.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/generateGridActionLinks.js
blob: 5b3f9c1e5fa4c5c76fbd15c075328bcdc9958fc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
export default {
  slots: {
    actionLinks: {validate: v => v.sparseArrayOf(v.isHTML)},
  },

  generate: (slots, {html}) =>
    html.tag('div', {class: 'grid-actions'},
      {[html.onlyIfContent]: true},

      (slots.actionLinks ?? [])
        .filter(link => link && !html.isBlank(link))
        .map(link => link
          .slot('attributes', {class: ['grid-item', 'box']}))),
};