« get me outta code hell

generateSearchSidebarBox.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/generateSearchSidebarBox.js
blob: 188a678f54ec9252df02eafd6b85cb1e9693e92e (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
export default {
  contentDependencies: ['generatePageSidebarBox'],
  extraDependencies: ['html', 'language'],

  relations: (relation) => ({
    sidebarBox:
      relation('generatePageSidebarBox'),
  }),

  generate: (relations, {html, language}) =>
    language.encapsulate('misc.search', capsule =>
      relations.sidebarBox.slots({
        attributes: {class: 'wiki-search-sidebar-box'},
        collapsible: false,

        content: [
          html.tag('label', {class: 'wiki-search-label'},
            html.tag('input', {class: 'wiki-search-input'},
              {type: 'search'},

              {
                placeholder:
                  language.$(capsule, 'placeholder').toString(),
              })),

          html.tag('template', {class: 'wiki-search-preparing-string'},
            language.$(capsule, 'preparing')),

          html.tag('template', {class: 'wiki-search-loading-data-string'},
            language.$(capsule, 'loadingData')),

          html.tag('template', {class: 'wiki-search-searching-string'},
            language.$(capsule, 'searching')),

          html.tag('template', {class: 'wiki-search-failed-string'},
            language.$(capsule, 'failed')),

          html.tag('template', {class: 'wiki-search-no-results-string'},
            language.$(capsule, 'noResults')),

          html.tag('template', {class: 'wiki-search-current-result-string'},
            language.$(capsule, 'currentResult')),

          html.tag('template', {class: 'wiki-search-end-search-string'},
            language.$(capsule, 'endSearch')),

          language.encapsulate(capsule, 'resultKind', capsule => [
            html.tag('template', {class: 'wiki-search-album-result-kind-string'},
              language.$(capsule, 'album')),

            html.tag('template', {class: 'wiki-search-artist-result-kind-string'},
              language.$(capsule, 'artist')),

            html.tag('template', {class: 'wiki-search-group-result-kind-string'},
              language.$(capsule, 'group')),

            html.tag('template', {class: 'wiki-search-tag-result-kind-string'},
              language.$(capsule, 'artTag')),
          ]),
        ],
      })),
};