Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

178 righe
6.8 KiB

  1. import './marketingheader.scss';
  2. import '../../components/artwork/artwork.scss';
  3. import '../slider/slider.scss';
  4. import $ from 'jquery';
  5. import {createElement, createImage} from "../../_global/scripts/helpers";
  6. import {createArtwork} from "../../components/artwork/ArtworkComponent";
  7. import {createSearchInput} from "../../atoms/search-input/SearchInputComponent";
  8. import {createSearchButton} from "../../atoms/search-button/SearchButtonComponent";
  9. import IHKSearchTypeahead from "./marketingheader-typeahead";
  10. import {createButton} from "../../atoms/button/ButtonComponent";
  11. import IHKMHSlider from "./marketingheaderslider";
  12. import {searchData, teaserData, sliderData} from "./MarketingHeaderData";
  13. export const createMarketingHeader =
  14. ({
  15. artworkStyle = 'artwork-both-sides',
  16. placeholder = 'Hier Ihr Thema finden',
  17. api = 'services/search/{SEARCHTERM}.json',
  18. tiles = searchData,
  19. imageSrc = 'https://source.unsplash.com/2vCqH34PqWs/1080x648',
  20. kicker = 'Noch 7 Tage offen',
  21. headline = 'Jetzt und digital mitreden',
  22. copy = 'Mit der digitalen Beteiligung erhalten Mitgliedsunternehmen die Möglichkeit, sich einfach und schnell über laufende Verfahren und Abstimmungen zu informieren und sich aktiv daran zu beteiligen.',
  23. moreCta = {
  24. label: 'Mehr Infos',
  25. link: '#',
  26. target: '_self',
  27. },
  28. buttonCta = {
  29. label: 'Jetzt beteiligen',
  30. link: '#',
  31. target: '_self',
  32. },
  33. showProgress = true,
  34. progress = 60,
  35. backgroundImage = null,
  36. isFirstElement = false,
  37. slides = sliderData,
  38. teasers = teaserData,
  39. }) => {
  40. const section = createElement('section', ['marketingheader'], null);
  41. const search = createElement('div', ['search'], null, section);
  42. const artwork = createArtwork({type: artworkStyle});
  43. search.appendChild(artwork);
  44. search.dataset.type = artworkStyle;
  45. const container = createElement('div', ['container', 'small'], null, search);
  46. const row = createElement('div', ['row'], null, container);
  47. const col = createElement('div', ['col'], null, row);
  48. const form = createElement('form', [], null, col);
  49. const label = createElement('label', ['visually-hidden'], 'IHK durchsuchen', form);
  50. label.for = 'search-term';
  51. form.appendChild(createSearchInput({api: api, placeholder: placeholder}));
  52. form.appendChild(createSearchButton({}));
  53. form.action = '#';
  54. const tilesContainer = createElement('div', ['tiles'], null, col);
  55. tiles.map((tile) => {
  56. const div = createElement('div', ['tile'], null, tilesContainer);
  57. const a = createElement('a', [], tile.title, div);
  58. a.href = tile.link;
  59. })
  60. if (api) {
  61. new IHKSearchTypeahead($(form).find('input.typeahead'));
  62. }
  63. /* SLIDER */
  64. const container2 = createElement('div', ['container', 'slidercontainer', 'rotation'], null, section);
  65. const sliderComponent = createElement('div', ['slider'], null, container2);
  66. slides.map((slideData, index) => {
  67. const slide = createElement('div', ['slide'], null, sliderComponent);
  68. const outer = createElement('outer', ['outer'], null, slide);
  69. const contextBoxContent = slideData.context ? slideData.context : '';
  70. const contextBoxContentImg = slideData.contextImg ? slideData.contextImg : '';
  71. if (slideData.imageSrc && slideData.imageSrc.length > 0) {
  72. const imageBox = createElement('div', ['image-box'], null, outer);
  73. createImage(slideData.imageSrc, 900, 600, 'Slide ' + index, [], imageBox);
  74. if (contextBoxContentImg) {
  75. const contentBoxImg = createElement('div', ['context-box', 'context-box--image'], null, imageBox);
  76. createImage(contextBoxContentImg, 200, 50, '', [], contentBoxImg);
  77. } else if (contextBoxContent) {
  78. createElement('div', ['context-box'], contextBoxContent, imageBox);
  79. }
  80. }
  81. const textBox = createElement('div', ['text-box'], null, outer);
  82. if (slideData.kicker && slideData.kicker.length > 0) {
  83. createElement('span', ['kicker'], slideData.kicker, textBox);
  84. }
  85. if (slideData.headline && slideData.headline.length > 0) {
  86. createElement('h3', ['like-h2'], slideData.headline, textBox);
  87. }
  88. if (slideData.kicker && slideData.kicker.length > 0) {
  89. createElement('p', [], slideData.copy, textBox);
  90. }
  91. if (slideData.cta && slideData.link) {
  92. const buttonP = createElement('p', [], '', textBox);
  93. const btn = createButton({
  94. color: 'white', icon: 'pfeil-simple-rechts', iconPosition: 'icon-right', label: slideData.cta
  95. });
  96. buttonP.appendChild(btn);
  97. }
  98. if (!slideData.imageSrc || slideData.imageSrc.length <= 0) {
  99. if (contextBoxContent) {
  100. textBox.classList.add('context');
  101. if (contextBoxContentImg) {
  102. const contentBox = createElement('div', ['context-box', 'context-box--image'], null, textBox);
  103. createImage(contextBoxContentImg, 200, 50, '', [], contentBox);
  104. } else if (contextBoxContent) {
  105. createElement('div', ['context-box'], contextBoxContent, textBox);
  106. }
  107. }
  108. }
  109. })
  110. new IHKMHSlider($(sliderComponent));
  111. /*
  112. const hasImage = imageSrc && imageSrc.length > 0;
  113. const stage = createElement('div', ['participation', 'participation-stage'], null, section);
  114. const container2 = createElement('div', ['container'], null, stage);
  115. const row2 = createElement('div', ['row'], null, container2);
  116. const col2 = createElement('div', ['col'], null, row2);
  117. const tb2 = createElement('div', ['text-box'], null, col2);
  118. if (backgroundImage && backgroundImage.length > 0) {
  119. //section.content('style=background: red;');
  120. stage.style = 'background-image: url(' + backgroundImage + ');';
  121. stage.classList.add('background-image');
  122. }
  123. if (isFirstElement) {
  124. stage.classList.add('first-element');
  125. }
  126. if (kicker && kicker.length > 0) {
  127. createElement('p', ['kicker'], kicker, tb2);
  128. }
  129. if (showProgress) {
  130. tb2.appendChild(createProgressBar({progress}));
  131. }
  132. createElement('h1', ['like-h2'], headline, tb2);
  133. createElement('p', [], copy, tb2);
  134. if (moreCta) {
  135. const more = createElement('a', [], moreCta.label, tb2);
  136. more.href = moreCta.link;
  137. more.target = moreCta.target;
  138. }
  139. if (buttonCta) {
  140. const button2 = createButton({
  141. elementType: 'a',
  142. link: buttonCta.link,
  143. color: 'white',
  144. label: buttonCta.label,
  145. iconPosition: 'icon-right',
  146. icon: 'small-arrow-right-simple',
  147. });
  148. tb2.appendChild(button2);
  149. }
  150. if (hasImage) {
  151. stage.classList.add('image-stage');
  152. const ib2 = createElement('div', ['image-box'], null, col2);
  153. createImage(imageSrc, 1080, 648, 'Beteiligung', [], ib2);
  154. }
  155. */
  156. return section;
  157. }