Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 

46 рядки
1.5 KiB

  1. import './link-collection.scss';
  2. import {createElement} from "../../_global/scripts/helpers";
  3. import {linkListCopyData} from "../linklist/LinkListData";
  4. import IHKLinkCollection from "./link-collection";
  5. import {createLinkList} from "../linklist/LinkListComponent";
  6. import {createButton} from "../../atoms/button/ButtonComponent";
  7. export const createLinkCollection =
  8. ({
  9. headline = 'Meistgeklickt',
  10. linkListData = linkListCopyData,
  11. buttonText = 'Alle Pressemitteilungen anzeigen',
  12. addContainer = false,
  13. }) => {
  14. const wrapper = createElement('div', ['link-collection']);
  15. if (headline && headline.length > 0) {
  16. createElement('h2', [], headline, wrapper);
  17. }
  18. wrapper.appendChild(createLinkList({links: linkListData}));
  19. if (buttonText && buttonText.length > 0) {
  20. const btnWrapper = createElement('div', ['btn-wrapper'], null, wrapper);
  21. const btn = createButton({
  22. elementType: 'a',
  23. label: buttonText,
  24. icon: 'pfeil-rechts',
  25. iconPosition: 'icon-right',
  26. })
  27. btnWrapper.appendChild(btn);
  28. }
  29. new IHKLinkCollection(wrapper);
  30. if (addContainer) {
  31. const section = createElement('section', ['link-collection-wrapper']);
  32. const container = createElement('div', ['container'], null, section);
  33. const row = createElement('div', ['row'], null, container);
  34. const col = createElement('div', ['col'], null, row);
  35. col.appendChild(wrapper);
  36. return section;
  37. }
  38. return wrapper;
  39. }