import './testimonial.scss';
import './testimonial.js';
import {createElement, createImage} from "../../_global/scripts/helpers";
import {testimonialData} from "./TestimonialData";

export const createTestimonial =
({
     article = false,
     listItems: listItems = testimonialData,
     author = 'Nadine Kurz, IHK Rhein-Neckar',
     subline = 'Dolleruper Windpark GmbH & Co. KG',
     text = 'Mit dem modularen IHK24-System setzen wir flexibel und einfach die digitale Kommunikation unserer IHK um. Unsere Kunden und Redakteure profitieren von den modernen und nutzerfreundlichen Anwendungen.',
     image = './dummy/why-elect.jpg',
 }) => {
    let output;
    let div;
    if (article === true) {
        output = createElement('div', ['small-quote'], null);
        div = createElement('div', ['image-text', 'is-blockquote'], null, output);
    } else {
        div = createElement('div', ['image-text', 'is-blockquote'], null);
    }
    const div2 = createElement('div', ['image-text--image'], null, div);
    const div3 = createElement('div', ['image-text--text'], null, div);
    createImage(image, 1280, 1280, '', [], div2);

    const blockquote = createElement('blockquote', [], null, div3);
    createElement('div', ['text'], text, blockquote);
    const div4 = createElement('div', ['author-text'], null, blockquote);
    const div5 = createElement('div', ['author-text--inner'], null, div4);
    createElement('div', ['text', 'author'], author, div5);
    createElement('div', ['text', 'author-subline'], subline, div5);

    if (article === true) {
        console.log(article);
        return output;
    } else {
        console.log(article);
        return div;
    }
}
