-
Notifications
You must be signed in to change notification settings - Fork 45
/
-15-layout-sub-template.twig
116 lines (110 loc) · 3.98 KB
/
-15-layout-sub-template.twig
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
{% include '@pl/00-layout-docs.twig' %}
{% set notes %}
All templates work with nested layouts, while there is one special template that is specifically designed for nested layouts. <code>full-vertical-push-last-item</code> creates a vertical layout that is 100% height, and its last item is pushed to the bottom. This particular template serves a specific purpose and does not work with the layout’s vertical and horizontal alignments.
{% endset %}
{% set demo %}
<bolt-layout template="tiles@from-small" gutter="xlarge" class="t-bolt-light">
<bolt-layout-item>
<bolt-layout template="full-vertical-push-last-item">
<bolt-layout-item>
<bolt-text>In this layout, there is a parent layout that is handling the 2 columns. Within each column, there is a nested layout that is full height and it pushes its last item to the bottom. Even though the first column is taller than the second column, the last items in each column are aligned to the bottom.</bolt-text>
</bolt-layout-item>
<bolt-layout-item>
<bolt-placeholder>Last layout item pushed to bottom</bolt-placeholder>
</bolt-layout-item>
</bolt-layout>
</bolt-layout-item>
<bolt-layout-item>
<bolt-layout template="full-vertical-push-last-item">
<bolt-layout-item>
<bolt-text>Nested layout with 2 layout items, this paragraph of text being the first item.</bolt-text>
</bolt-layout-item>
<bolt-layout-item>
<bolt-placeholder>Last layout item pushed to bottom</bolt-placeholder>
</bolt-layout-item>
</bolt-layout>
</bolt-layout-item>
<bolt-layout-item>
<bolt-layout template="full-vertical-push-last-item">
<bolt-layout-item>
<bolt-text>Now with actual text and a CTA button. Ready to crush business complexity? Our software helps you work smarter, simpler, and faster.</bolt-text>
</bolt-layout-item>
<bolt-layout-item>
<a href="https://pega.com" class="e-bolt-button e-bolt-button--block">
Let’s go!
</a>
</bolt-layout-item>
</bolt-layout>
</bolt-layout-item>
</bolt-layout>
{% endset %}
{% set twig_markup %}
{% verbatim %}
// Set up nested layout
{% set nested_layout %}
{% set layout_items %}
{% include '@bolt-layouts-layout/layout-item.twig' with {
content: 'Layout item'
} only %}
{% include '@bolt-layouts-layout/layout-item.twig' with {
content: 'Layout item'
} only %}
{% endset %}
{% include '@bolt-layouts-layout/layout.twig' with {
content: layout_items,
template: [
'full-vertical-push-last-item',
],
} only %}
{% endset %}
// Pass nested layouts to parent layout
{% set layout_items %}
{% include '@bolt-layouts-layout/layout-item.twig' with {
content: nested_layout
} only %}
{% include '@bolt-layouts-layout/layout-item.twig' with {
content: nested_layout
} only %}
{% endset %}
{% include '@bolt-layouts-layout/layout.twig' with {
content: layout_items,
template: [
'halves@from-small',
],
} only %}
{% endverbatim %}
{% endset %}
{% set html_markup %}
{% verbatim %}
<bolt-layout template="halves@from-small">
<bolt-layout-item>
<bolt-layout template="full-vertical-push-last-item">
<bolt-layout-item>
<!-- Content goes here -->
</bolt-layout-item>
<bolt-layout-item>
<!-- Content goes here -->
</bolt-layout-item>
</bolt-layout>
</bolt-layout-item>
<bolt-layout-item>
<bolt-layout template="full-vertical-push-last-item">
<bolt-layout-item>
<!-- Content goes here -->
</bolt-layout-item>
<bolt-layout-item>
<!-- Content goes here -->
</bolt-layout-item>
</bolt-layout>
</bolt-layout-item>
</bolt-layout>
{% endverbatim %}
{% endset %}
{% include '@utils/pattern-doc-page.twig' with {
title: 'Sub-template and Nested Layout',
description: 'A layout can be nested in another layout (i.e. put a layout inside a layout item).',
notes: notes,
demo: demo,
twig_markup: twig_markup,
html_markup: html_markup,
} only %}