{% import "../helpers/general.html" %} {% import "./text.html" %} {% import "./image-icon.html" %} {% import "./carousel.html" %} {% macro testimonialComponent(data = {}) %} {% set args = { "visible" : true, "customer" : "", "company" : "", "image": "", "title" : "", "text" : "", "layout" : { "show_image": true, "show_name" : true, "show_company" : true, "show_title" : true, "background" : "", "rounded" : true, "inline" : false, "img_round" : true, "alignment" : 'center', }, "innerClass": "", "contentClass": "", "class" : '' } %} {% set args = deepUpdate(args,data)|fromjson %} {% set itemClass = ['testimonial-item'] %} {% do args.class ? itemClass.append(args.class) : '' %} {% set background = (!!args.layout.background && args.layout.background != 'default') ? args.layout.background : '' %} {% do background ? itemClass.append('swatch-'+background) : '' %} {% do background && args.layout.rounded ? itemClass.append('rounded-1') : '' %} {% if !!args.visible %}
{% set itemInnerClass = ['item-inner','d-flex', 'flex-column'] %} {% do args.innerClass ? itemClass.append(args.innerClass) : '' %} {% set alignment = (!!args.layout.alignment && args.layout.alignment != 'default') ? args.layout.alignment : '' %} {% do alignment ? itemInnerClass.append('text-'+alignment+' align-items-'+alignment) : '' %}
{% if args.layout.show_image %}
{{ imageComponent({ "image" : args.image, "type" : "raw", "size" : "cover", "ratio" : "square", "class" : "border border-2"+(args.layout.img_round ? " round" : '') }) }}
{% endif %}
{{ args.text }}
{{ headingComponent({ "tag" : "h6", "text" : args.customer, "class" : "mb-1 heading-inherit" }) }} {{ subheadingComponent({ "text" : args.layout.show_title ? args.title : '', "class" : "my-0" }) }} {{ subheadingComponent({ "text" : args.layout.show_company ? args.company : '', "class" : "my-0" }) }}
{% endif %} {% endmacro%} {% macro testimonialsComponent(data = {},makeCarousel = true) -%} {% set args = { "source" : "", "testimonials" : [], "globalKeys" : { "global" : "testimonials" }, "layout" : {}, "class" : "" } %} {% do args.update(data) %} {# carouselSettingsFromData #} {% set carousel = (args.swiper is defined && type(args.swiper) == 'dict') ? args.swiper || {} : {} %} {% if !!args.source %} {# Get Source - 'global' or 'custom' #} {% set items = (!!args.globalKeys[args.source] ? global_options|attr(args.globalKeys[args.source]) : args.testimonials) || [] %} {# Get Enabled #} {% set testimonials = [] %} {% 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 testimonials.append(item) %} {% endif %} {% endfor %} {% set testimonials = testimonials|rejectattr('visible',false) %} {% set makeCarousel = makeCarousel && carousel.enable %}
{% if !!makeCarousel %} {% set carouselOut %} {% call maybeCarousel(makeCarousel,carousel) %} {% for testimonial in testimonials %} {% do testimonial.update({ "class" : (makeCarousel ? 'swiper-slide' : ''), "innerClass" : (testimonials|length > 1 ? 'p-2 p-md-3' : '') }) %} {{ testimonialComponent(testimonial) }} {% endfor %} {% endcall %} {% endset %} {{ carouselOut }} {% else %} {% set columns = args.layout.columns|int || 3 %} {% set col_size = (12/columns)|int %}
{% for testimonial in testimonials %}
{{ testimonialComponent(testimonial) }}
{% endfor %}
{% endif %}
{% endif %} {%- endmacro %}