« 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: f5b1aaa6cce757b056ef0a89b5bdd5b36504c20a (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 '#sugar';

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']}))));
  },
};