Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

35 linhas
1.1 KiB

  1. import './topic-teasers.scss';
  2. import $ from 'jquery';
  3. import {createElement} from "../../_global/scripts/helpers";
  4. import {Topics, TopicsWithLinklist} from "./TopicTeasersData";
  5. import {createTopicTeaser} from "../../components/topic-teaser/TopicTeaserComponent";
  6. import IHKTopicTeasers from "./topic-teasers";
  7. export const createTopicTeasersSection = ({
  8. headline = 'Unsere Themensammlung',
  9. type = 'single-topic',
  10. maxItems = 6,
  11. data = type === 'single-topic' ? Topics : TopicsWithLinklist,
  12. }) => {
  13. const section = createElement('section', ['topics']);
  14. section.dataset.type = type === 'single-topic' ? 'single' : 'list';
  15. const container = createElement('div', ['container'], null, section);
  16. if (headline && headline.length > 0) {
  17. createElement('h2', [], headline, container);
  18. }
  19. const row = createElement('div', ['row'], null, container);
  20. data.map((topic, i) => {
  21. if (i < maxItems) {
  22. const col = createElement('div', ['col'], null, row);
  23. const teaser = createTopicTeaser({...topic, type: type});
  24. col.appendChild(teaser);
  25. }
  26. })
  27. new IHKTopicTeasers($(section));
  28. return section;
  29. }