25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

60 lines
2.0 KiB

  1. import './header.scss';
  2. import {createElement, createImage} from "../../_global/scripts/helpers";
  3. import $ from "jquery";
  4. import IHKHeader from "./header";
  5. import {createNav} from "../nav/NavComponent";
  6. import {createIhkSwitch} from "../ihk-switch/IHKSwitchComponent";
  7. import {createHeaderSearch} from "../header-search/HeaderSearchComponent";
  8. export const createHeader =
  9. ({
  10. isZip = false,
  11. contactPhone,
  12. contactMail,
  13. contactLink = '#',
  14. loginLink = '#',
  15. }) => {
  16. const header = createElement('header', ['page-header']);
  17. const logo = createElement('a', ['logo'], '', header);
  18. logo.href = '#';
  19. createImage('./logos/musterstadt.svg', 100, 50, 'IHK Logo', [], logo);
  20. const contactNav = createElement('ul', ['contact-nav'], null, header);
  21. if (loginLink) {
  22. const li = createElement('li', [], null, contactNav);
  23. const a = createElement('a', ['login'], 'Login', li);
  24. a.href = '#';
  25. }
  26. if (contactPhone) {
  27. const li = createElement('li', [], null, contactNav);
  28. const a = createElement('a', ['phone'], contactPhone, li);
  29. a.href = 'tel:' + contactPhone.split(' ').join('').split('/').join().split('-').join('');
  30. }
  31. if (contactMail) {
  32. const li = createElement('li', [], null, contactNav);
  33. const a = createElement('a', ['mail'], 'E-Mail', li);
  34. a.href = 'mailto:' + contactMail;
  35. }
  36. if (contactLink) {
  37. const li = createElement('li', [], null, contactNav);
  38. const a = createElement('a', ['contact'], 'Kontakt', li);
  39. a.href = contactLink;
  40. }
  41. const searchWrap = createElement('div', ['search'], null, header);
  42. createElement('button', ['open-search'], 'Suche', searchWrap);
  43. searchWrap.appendChild(createHeaderSearch({}));
  44. createElement('button', ['close-search'], 'Suche verlassen', searchWrap);
  45. createElement('button', ['toggle-nav'], '<span>Menü</span>', header);
  46. header.appendChild(createNav({}));
  47. header.appendChild(createIhkSwitch({zip: isZip}));
  48. new IHKHeader($(header));
  49. return header;
  50. };