|
- import './tile-grid-wood.scss';
- import {createElement, createImage} from "../../_global/scripts/helpers";
- import {TileGridWoodData} from "./TileGridWoodData";
- import IHKTileGridWood from "./tile-grid-wood";
- import IHKEventOverviewTiles from "../eventoverview-stage/eventoverview";
-
- export const createTileGrid = ({
- headline = 'Daten und Fakten auf einen Blick',
- tiles = TileGridWoodData,
- }) => {
- const section = createElement('section', ['tile-grid']);
- const container = createElement('div', ['container'], null, section);
- createElement('h2', [], headline, container);
- const row = createElement('div', ['row'], null, container);
-
- tiles.map((group) => {
- const col = createElement('div', ['col'], null, row);
- const head = createElement('div', ['tile-head'], null, col);
- const tileLink = createElement('a', ['tile-head-outer'], null, head);
- tileLink.href = group.titleUrl;
- createElement('h3', ['like-h4'], group.title, tileLink);
-
- group.tiles.map((item) => {
- const tile = createElement('div', ['tile'], null, col);
- let tileLink;
- if (item.url) {
- tileLink = createElement('a', ['tile-outer'], null, tile);
- tileLink.href = item.url;
- } else {
- tileLink = createElement('span', ['tile-outer'], null, tile);
- }
- if (item.icon) {
- const iconBox = createElement('div', ['icon'], null, tileLink);
- createImage(item.icon, 220, 220, ['icon'], [], iconBox);
- }
- if (item.dynamicIcon) {
- const iconBox = createElement('div', ['icon','dynamic-icon'], null, tileLink);
- iconBox.classList.add(item.dynamicIcon);
- }
- const p = createElement('p', [], null, tileLink);
- const num = createElement('span', ['number'], item.number, p);
- if (item.unit) {
- createElement('small', [], item.unit, num);
- }
- createElement('span', ['label'], item.label, p);
- })
- new IHKTileGridWood($(section));
- })
-
- return section;
- }
|