您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

216 行
8.1 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. import {createMiniTeaser} from "../../components/mini-teaser/MiniTeaserComponent";
  14. import IHKSearchAccordion from "./searchAccordion";
  15. export const createMarketingHeader =
  16. ({
  17. artworkStyle = 'artwork-both-sides',
  18. placeholder = 'Hier Ihr Thema finden',
  19. api = 'services/search/{SEARCHTERM}.json',
  20. tiles = searchData,
  21. kicker = 'Noch 7 Tage offen',
  22. headline = 'Jetzt und digital mitreden',
  23. 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.',
  24. moreCta = {
  25. label: 'Mehr Infos',
  26. link: '#',
  27. target: '_self',
  28. },
  29. buttonCta = {
  30. label: 'Jetzt beteiligen',
  31. link: '#',
  32. target: '_self',
  33. },
  34. showProgress = true,
  35. progress = 60,
  36. backgroundImage = null,
  37. isFirstElement = false,
  38. slides = sliderData,
  39. teasers = teaserData,
  40. maxItems = 3,
  41. type = 'infoteaser',
  42. }) => {
  43. const section = createElement('section', ['marketingheader', type], null);
  44. const search = createElement('div', ['search'], null, section);
  45. if (backgroundImage && backgroundImage.length > 0) {
  46. search.style = 'background-image: url(' + backgroundImage + ');';
  47. search.classList.add('background-image');
  48. }
  49. const artwork = createArtwork({type: artworkStyle});
  50. search.appendChild(artwork);
  51. search.dataset.type = artworkStyle;
  52. const container = createElement('div', ['container', 'small'], null, search);
  53. const row = createElement('div', ['row'], null, container);
  54. const col = createElement('div', ['col'], null, row);
  55. const form = createElement('form', [], null, col);
  56. const label = createElement('label', ['visually-hidden'], 'IHK durchsuchen', form);
  57. label.for = 'search-term';
  58. form.appendChild(createSearchInput({api: api, placeholder: placeholder}));
  59. form.appendChild(createSearchButton({}));
  60. form.action = '#';
  61. const tilesContainer = createElement('div', ['tiles'], null, col);
  62. tiles.map((tile) => {
  63. const div = createElement('div', ['tile'], null, tilesContainer);
  64. const a = createElement('a', [], tile.title, div);
  65. a.href = tile.link;
  66. })
  67. if (api) {
  68. new IHKSearchTypeahead($(form).find('input.typeahead'));
  69. }
  70. /* Accordion */
  71. const sc = createElement('div', ['container','sc'], null, search);
  72. $(document).ready(() => {
  73. new IHKSearchAccordion($(search));
  74. })
  75. createElement('button', ['close-search'], '', sc);
  76. /* SLIDER */
  77. const container2 = createElement('div', ['container', 'mainstage'], null, section);
  78. const row2 = createElement('div', ['row'], null, container2);
  79. const colslider = createElement('div', ['col', 'slidercontainer', 'rotation'], null, row2);
  80. //const col2 = createElement('div', ['col'], null, row2);
  81. const sliderComponent = createElement('div', ['slider'], null, colslider);
  82. slides.map((slideData, index) => {
  83. const slide = createElement('div', ['slide'], null, sliderComponent);
  84. const outer = createElement('outer', ['outer'], null, slide);
  85. const contextBoxContent = slideData.context ? slideData.context : '';
  86. const contextBoxContentImg = slideData.contextImg ? slideData.contextImg : '';
  87. if (slideData.imageSrc && slideData.imageSrc.length > 0) {
  88. const imageBox = createElement('div', ['image-box'], null, outer);
  89. createImage(slideData.imageSrc, 900, 600, 'Slide ' + index, [], imageBox);
  90. if (contextBoxContentImg) {
  91. const contentBoxImg = createElement('div', ['context-box', 'context-box--image'], null, imageBox);
  92. createImage(contextBoxContentImg, 200, 50, '', [], contentBoxImg);
  93. } else if (contextBoxContent) {
  94. createElement('div', ['context-box'], contextBoxContent, imageBox);
  95. }
  96. }
  97. const textBox = createElement('div', ['text-box'], null, outer);
  98. if (slideData.kicker && slideData.kicker.length > 0) {
  99. createElement('span', ['kicker'], slideData.kicker, textBox);
  100. }
  101. if (slideData.headline && slideData.headline.length > 0) {
  102. createElement('h3', ['like-h2'], slideData.headline, textBox);
  103. }
  104. if (slideData.kicker && slideData.kicker.length > 0) {
  105. createElement('p', [], slideData.copy, textBox);
  106. }
  107. if (slideData.cta && slideData.link) {
  108. const buttonP = createElement('p', [], '', textBox);
  109. const btn = createButton({
  110. color: 'white', icon: 'pfeil-simple-rechts', iconPosition: 'icon-right', label: slideData.cta, size: 'small',
  111. });
  112. buttonP.appendChild(btn);
  113. }
  114. if (!slideData.imageSrc || slideData.imageSrc.length <= 0) {
  115. if (contextBoxContent) {
  116. textBox.classList.add('context');
  117. if (contextBoxContentImg) {
  118. const contentBox = createElement('div', ['context-box', 'context-box--image'], null, textBox);
  119. createImage(contextBoxContentImg, 200, 50, '', [], contentBox);
  120. } else if (contextBoxContent) {
  121. createElement('div', ['context-box'], contextBoxContent, textBox);
  122. }
  123. }
  124. }
  125. })
  126. new IHKMHSlider($(sliderComponent));
  127. if (type === 'infoteaser') {
  128. const col3 = createElement('div', ['col'], null, row2);
  129. //const teasers = createMiniTeaser({teasers.type: 'standard'});
  130. //col3.appendChild(teasers);
  131. teasers.map((t, i) => {
  132. if (i < maxItems) {
  133. var typ = 'standard';
  134. if (i == 0 && t.type == 'infoteaser') typ = 'infoteaser';
  135. const col4 = createElement('div', ['mt'], null, col3);
  136. const tea = createMiniTeaser({
  137. type : typ,
  138. })
  139. col4.appendChild(tea);
  140. }
  141. })
  142. }
  143. /*
  144. const hasImage = imageSrc && imageSrc.length > 0;
  145. const stage = createElement('div', ['participation', 'participation-stage'], null, section);
  146. const container2 = createElement('div', ['container'], null, stage);
  147. const row2 = createElement('div', ['row'], null, container2);
  148. const col2 = createElement('div', ['col'], null, row2);
  149. const tb2 = createElement('div', ['text-box'], null, col2);
  150. if (backgroundImage && backgroundImage.length > 0) {
  151. //section.content('style=background: red;');
  152. stage.style = 'background-image: url(' + backgroundImage + ');';
  153. stage.classList.add('background-image');
  154. }
  155. if (isFirstElement) {
  156. stage.classList.add('first-element');
  157. }
  158. if (kicker && kicker.length > 0) {
  159. createElement('p', ['kicker'], kicker, tb2);
  160. }
  161. if (showProgress) {
  162. tb2.appendChild(createProgressBar({progress}));
  163. }
  164. createElement('h1', ['like-h2'], headline, tb2);
  165. createElement('p', [], copy, tb2);
  166. if (moreCta) {
  167. const more = createElement('a', [], moreCta.label, tb2);
  168. more.href = moreCta.link;
  169. more.target = moreCta.target;
  170. }
  171. if (buttonCta) {
  172. const button2 = createButton({
  173. elementType: 'a',
  174. link: buttonCta.link,
  175. color: 'white',
  176. label: buttonCta.label,
  177. iconPosition: 'icon-right',
  178. icon: 'small-arrow-right-simple',
  179. });
  180. tb2.appendChild(button2);
  181. }
  182. if (hasImage) {
  183. stage.classList.add('image-stage');
  184. const ib2 = createElement('div', ['image-box'], null, col2);
  185. createImage(imageSrc, 1080, 648, 'Beteiligung', [], ib2);
  186. }
  187. */
  188. return section;
  189. }