import './miniteaser.scss'; import {createElement} from "../../_global/scripts/helpers"; import { createButton } from '../../atoms/button/ButtonComponent'; export const createMiniTeaser = ({ type = 'standard', category = 'IHK Mitgliedschaft', title = 'Werden Sie Teil unseres Netzwerks!', link = '#', icon = 'Roboter', buttonlabel = 'IHK-Newsletter sichern', backgroundImage = null, }) => { if (type === 'standard') { const tile = createElement('a', ['tile', 'mini-teaser', type], null); tile.href = link; const textBox = createElement('div', ['text-box'], null, tile); createElement('h5', ['category'], category, textBox); createElement('h4', ['title'], title, textBox); return tile; }else{ const tile = createElement('a', ['tile', 'mini-teaser', type], null); tile.href = link; if (backgroundImage && backgroundImage.length > 0) { tile.style = 'background-image: url(' + backgroundImage + ');'; tile.classList.add('background-image'); } const textBox = createElement('div', ['text-box'], null, tile); if (icon && icon.length > 0) { createElement('div', ['icon-box', 'pictogram-' + icon.toLowerCase().split(' ').join('-')], null, textBox); createElement('h4', ['title'], title, textBox); textBox.appendChild(createButton({elementType: 'span',color: 'white', label: buttonlabel,iconPosition: 'icon-right', icon: null, preventClick: false})) }else{ createElement('h4', ['title', 'noicon'], title, textBox); textBox.appendChild(createButton({elementType: 'span',color: 'white', label: buttonlabel, iconPosition: 'icon-right', icon: null, preventClick: false})) } return tile; } }