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.
 
 
 
 

70 righe
2.5 KiB

  1. import './contact.scss';
  2. import $ from 'jquery';
  3. import {createElement, createImage} from "../../_global/scripts/helpers";
  4. import {ContactData} from "./ContactData";
  5. import IHKContact from "./contact";
  6. export const createContact =
  7. ({
  8. headline = 'Ich helfe Ihnen gerne weiter',
  9. contacts = ContactData,
  10. contactCount = 2,
  11. addContainer = false,
  12. }) => {
  13. const wrapper = createElement('div', ['contact-wrapper']);
  14. if (headline && headline.length > 0) {
  15. createElement('h2', [], headline, wrapper);
  16. }
  17. const outer = createElement('div', ['contacts'], null, wrapper);
  18. contacts.map((data, index) => {
  19. if (index >= contactCount) {
  20. return;
  21. }
  22. const cp = createElement('div', ['contact-person'], null, outer);
  23. cp.dataset.contactTab = data.name;
  24. if (data.image && data.image.length > 0) {
  25. const ib = createElement('div', ['image-box'], null, cp);
  26. createImage(data.image, 360, 240, data.name, [], ib);
  27. }
  28. const tb = createElement('div', ['text-box'], null, cp);
  29. createElement('h3', ['like-h6'], data.name, tb);
  30. createElement('p', [], data.copy, tb);
  31. const buttons = createElement('ul', ['contact-buttons'], null, tb);
  32. const classes = ['btn', 'white', 'btn-small', 'icon-left'];
  33. if (data.phone && data.phone.length > 0) {
  34. const li = createElement('li', [], null, buttons);
  35. const a = createElement('a', ['icon-telefon', ...classes], data.phone, li);
  36. a.href = 'tel:' + data.phone.split('(').join('').split(')').join('');
  37. }
  38. if (data.mail && data.mail.length > 0) {
  39. const li = createElement('li', [], null, buttons);
  40. const a = createElement('a', ['icon-email', ...classes], 'E-Mail schreiben', li);
  41. a.href = 'mailto:' + data.mail;
  42. }
  43. if (data.fax && data.fax.length > 0) {
  44. const li = createElement('li', [], null, buttons);
  45. createElement('span', ['icon-fax', ...classes], data.fax, li);
  46. }
  47. if (data.vcard && data.vcard.length > 0) {
  48. const li = createElement('li', [], null, buttons);
  49. const a = createElement('a', ['icon-vcard', ...classes], 'Kontakt speichern', li);
  50. a.href = data.vcard;
  51. }
  52. })
  53. new IHKContact($(wrapper));
  54. if (addContainer) {
  55. const section = createElement('section', ['contact']);
  56. const container = createElement('div', ['container'], null, section);
  57. container.appendChild(wrapper);
  58. return section;
  59. }
  60. return wrapper;
  61. }