{% 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 }, "contentClass": "", "alignment" : 'start', "class" : '' } %} {% do args.update(data) %} {% set itemClass = ['testimonial-item'] %} {% do args.class ? itemClass.append(args.class) : '' %} {% if !!args.visible %}
{% set itemInnerClass = ['item-inner','d-flex', 'flex-column','p-2 p-md-4'] %} {% do (!!alignment && alignment != 'default') ? itemInnerClass.append('text-'+args.alignment+' align-items-'+args.alignment) : '' %}
{% if args.layout.show_image %}
{{ imageComponent({ "image" : args.image, "type" : "raw", "size" : "cover", "ratio" : "square", "class" : "round" }) }}
{% endif %}
{{ args.text }}
{{ headingComponent({ "tag" : "h4" , "text" : args.customer, "class" : "mb-1" }) }} {{ 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" : [], "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.source == 'global' ? global_options.testimonials : 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' : '') }) %} {{ 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 %}