{% import "../helpers/general.html" %} {% import "../components/link.html" %} {% import "../components/button.html" %} {% import "../components/image-icon.html" %} {% import "../components/text.html" %} {% macro blurbComponent(data) %} {% set args = { "layout" : { "media_type" : "none", "link_type" : "buttons", "blurb_bg" : false, "border_color" : false, "rounded" : true, "inline" : false, "add_hover" : false, "add_shadow" : false, "equal_height" : false }, "icon" : { "icon_type" : "fa", "fa_code" : "", "fa_color" : "", "image" : {} }, "image" : {}, "animated_number" : { "prefix" : "", "number" : "", "suffix" : "", "subtitle" : "" }, "text" : { "heading" : "", "description" : "" }, "link" : {}, "buttons" : [], "class" : "" } %} {% set args = deepUpdate(args,data)|fromjson %} {% set item_class = ['blurb-item','w-100'] %} {% do args.layout.equal_height ? item_class.append('d-md-flex h-100') : '' %} {% do args.layout.add_hover ? item_class.append('has-hover-effect') : '' %}
{% set item_inner_class = ['item-inner','d-inline-block','flex-grow-1','w-100'] %} {% do args.class ? item_inner_class.append(args.class) : '' %} {% set blurb_bg = (!!args.layout.blurb_bg && args.layout.blurb_bg != 'default') ? args.layout.blurb_bg : '' %} {% do blurb_bg ? item_inner_class.append('p-3 swatch-'+blurb_bg) : '' %} {% set border_color = (!!args.layout.border_color && args.layout.border_color != 'default') ? args.layout.border_color : '' %} {% do border_color ? item_inner_class.append('border border-2 border-'+border_color) : '' %} {% do args.layout.add_shadow ? item_inner_class.append('shadow-sm') : '' %} {% do args.layout.rounded ? item_inner_class.append('rounded-1') : '' %} {# make whole blurb clickable #} {% set blurbClickable = (args.layout.link_type == 'anywhere') && !!args.blurb_link.url.href %} {% set blurbLink = {} %} {% if blurbClickable %} {% do item_inner_class.append('link-inherit heading-inherit') %} {% set blurbLink = args.blurb_link || {} %} {% endif %} {% set linkOut %} {% call maybeLink({ link : blurbLink, noLinkTag : "div", class : item_inner_class|join(' ') }) %}
{% if !!args.layout.media_type && args.layout.media_type != 'none' %}
{% if args.layout.media_type == 'icon' && args.icon.fa_code %} {{ iconComponent({ "icon_type" : args.icon.icon_type, "fa_code" : args.icon.fa_code, "fa_color" : args.icon.fa_color, "image" : args.icon.image }) }} {% elif args.layout.media_type == 'image' %} {% if args.image.image.src %}
{% set context = args.image %} {{ imageComponent(context) }}
{% endif %} {% elif args.layout.media_type == 'animation' %}
{{ !!args.animated_number.prefix ? '' + args.animated_number.prefix +'' : '' }} {{args.animated_number.number}} {{ !!args.animated_number.suffix ? '' + args.animated_number.suffix +'' : '' }}
{{ args.animated_number.subtitle}}
{% endif %}
{% endif %}
{{ headingComponent({ "tag" : "h4" ,"text" : args.text.heading, "class" : "h5 mb-1 heading-inherit" }) }} {{ textComponent({ "text" : args.text.description, "class" : "item-description" }) }} {% if !blurbClickable %} {% set buttons = type(args.buttons) == 'list' ? args.buttons : [] %} {{ buttonSet({ "show" : !!buttons|length , "buttons" : buttons}) }} {% endif %}
{% endcall %} {% endset %} {{ linkOut }}
{% endmacro %} {% macro blurbsComponent(data = {},makeCarousel = true) -%} {% set args = { "items" : [], "layout" : {}, "horizontal_alignment" : 'center', "class" : "" } %} {% do args.update(data) %} {% set items = args.items || [] %} {# Get Enabled #} {% set blurbs = [] %} {% for item in items %} {% if item %} {% do item.update({ "visible" : ((item.visible is defined && item.visible) || item.visible is not defined), "layout" : args.layout || {} }) %} {% do blurbs.append(item) %} {% endif %} {% endfor %} {% set blurbs = blurbs|rejectattr('visible',false) %} {% if items|length %}
{% set columns = args.layout.columns|int || 3 %} {% set col_size = (12/columns)|int %}
{% for blurb in blurbs %}
{{ blurbComponent(blurb) }}
{% endfor %}
{% endif %} {%- endmacro %}