import './steps.scss';
import $ from 'jquery';
import {createElement} from "../../_global/scripts/helpers";
import {stepsData} from "./StepsData";
import '../../sections/slider/slider.scss';
import IHKSlider from "../../sections/slider/slider";

export const createSteps =
  ({
    headline = 'Schritt für Schritt zur Soforthilfe',
    contents = stepsData,
  }) => {
    const steps = createElement('div', ['steps']);
    if (headline && headline.length > 0) {
      createElement('h3', [], headline, steps);
    }

    const slider = createElement('div', ['slider'], null, steps);

    contents.map((step) => {
      const slide = createElement('div', ['slide'], step.content, slider);
      slide.dataset.title = step.tab;
    })

    new IHKSlider($(slider));

    return steps;
  }