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
|
// This component is kind of unfortunately magical. It reads the content of
// various boxes and joins them together, discarding the boxes' attributes.
// Since it requires access to the actual box *templates* (rather than those
// templates' resolved content), take care when slotting into this.
export default {
contentDependencies: ['generatePageSidebarBox'],
extraDependencies: ['html'],
relations: (relation) => ({
box:
relation('generatePageSidebarBox'),
}),
slots: {
attributes: {
type: 'attributes',
mutable: false,
},
boxes: {
validate: v => v.looseArrayOf(v.isTemplate),
},
},
generate: (relations, slots, {html}) =>
relations.box.slots({
attributes: slots.attributes,
content:
slots.boxes.slice()
.map(box => box.getSlotValue('content'))
.map((content, index, {length}) => [
content,
index < length - 1 &&
html.tag('hr', {
style:
`border-color: var(--primary-color); ` +
`border-style: none none dotted none`,
}),
]),
}),
};
|