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
|
import {unique} from '#sugar';
export default {
extraDependencies: ['html', 'language'],
query: (group) => ({
styles:
unique(group.albums.map(album => album.style)),
}),
data: (query, group) => ({
albums:
group.albums.length,
styles:
query.styles,
}),
generate: (data, {html, language}) =>
language.encapsulate('groupGalleryPage', pageCapsule =>
(data.styles.length <= 1
? html.blank()
: html.tag('p', {class: 'gallery-style-selector'},
{class: ['drop', 'shiny']},
language.encapsulate(pageCapsule, 'albumStyleSwitcher', capsule => [
html.tag('span',
language.$(capsule)),
html.tag('br'),
html.tag('span', {class: 'styles'},
data.styles.map(style =>
html.tag('label', {'data-style': style}, [
html.tag('input', {type: 'checkbox'},
{checked: true}),
html.tag('span',
language.$(capsule, style)),
]))),
html.tag('br'),
html.tag('span', {class: ['count', 'all']},
language.$(capsule, 'count.all', {
total: data.albums,
})),
html.tag('span', {class: ['count', 'filtered']},
{style: 'display: none'},
language.$(capsule, 'count.filtered', {
count: html.tag('span'),
total: data.albums,
})),
html.tag('span', {class: ['count', 'none']},
{style: 'display: none'},
language.$(capsule, 'count.none')),
])))),
};
|