« 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: 09399f17ff2026dfaf2b396bda04744ee5ed8c3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import {empty} from '../../util/sugar.js';

export default {
  extraDependencies: ['html'],

  slots: {
    actionLinks: {validate: v => v.sparseArrayOf(v.isHTML)},
  },

  generate(slots, {html}) {
    if (empty(slots.actionLinks)) {
      return html.blank();
    }

    return (
      html.tag('div', {class: 'grid-actions'},
        slots.actionLinks
          .filter(Boolean)
          .map(link => link
            .slot('attributes', {class: ['grid-item', 'box']}))));
  },
};