-
Notifications
You must be signed in to change notification settings - Fork 45
/
action-block.twig
45 lines (35 loc) · 980 Bytes
/
action-block.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
{# Sample Usage
{% include "@bolt/action-block.twig" with {
text: "Title",
url: "http://google.com",
icon: {
name: "icon-name",
size: "large",
background: "circle"
}
} only %}
#}
{% set prefix = "c-bolt-" %}
{% set attributes = create_attribute(attributes|default({})) %}
{% set componentName = "action-block" %}
{% set baseClass = prefix ~ componentName %}
{% set classes = [
baseClass
] %}
<bolt-{{ componentName }} bolt-component>
<a href="{{ url }}" {{ attributes.addClass(classes | raw) }}>
{% if icon %}
<div class="{{ "#{baseClass}__item #{baseClass}__icon" }}">
{% set icon = icon | merge({
size: icon.size | default("xlarge")
}) %}
{% include "@bolt/icon.twig" with icon only %}
</div>
{% endif %}
{% if text %}
<div class="{{ "#{baseClass}__item #{baseClass}__text" }}">
{{ text }}
</div>
{% endif %}
</a>
</bolt-{{ componentName }}>