« get me outta code hell

generateGridExpando.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/generateGridExpando.js
blob: 71c2f9701d40801509d6124f0a595792678025e1 (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
28
29
30
31
32
33
34
35
36
37
38
39
export default {
  extraDependencies: ['html', 'language'],

  slots: {
    caption: {type: 'html', mutable: false},
  },

  generate: (slots, {html, language}) =>
    language.encapsulate('misc.coverGrid', capsule =>
      html.tag('div', {class: 'grid-expando'},
        {[html.onlyIfSiblings]: true},

        html.tag('p', {class: 'grid-expando-content'},
          {[html.joinChildren]: html.tag('br')},

          [
            html.tag('span', {class: 'grid-caption'},
              slots.caption),

            !html.isBlank(slots.contentBelowCut) &&
              language.$(capsule, 'expandCollapseCue', {
                cue:
                  html.tag('a', {class: 'grid-expando-toggle'},
                    {href: '#'},

                    {[html.joinChildren]: ''},
                    {[html.noEdgeWhitespace]: true},

                    [
                      html.tag('span', {class: 'grid-expand-cue'},
                        language.$(capsule, 'expand')),

                      html.tag('span', {class: 'grid-collapse-cue'},
                        {style: 'display: none'},
                        language.$(capsule, 'collapse')),
                    ]),
              }),
          ]))),
};