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.
 
 
 
 

51 linhas
2.2 KiB

  1. import './miniteaser.scss';
  2. import {createElement} from "../../_global/scripts/helpers";
  3. import { createButton } from '../../atoms/button/ButtonComponent';
  4. export const createMiniTeaser = ({
  5. type = 'standard',
  6. category = 'IHK Mitgliedschaft',
  7. title = 'Werden Sie Teil unseres Netzwerks!',
  8. link = '#',
  9. icon = 'Roboter',
  10. buttonlabel = 'IHK-Newsletter sichern',
  11. backgroundImage = null,
  12. }) => {
  13. const variantMap = {
  14. 'standard': 'variant-subtle-primary',
  15. 'infoteaser': 'variant-solid',
  16. };
  17. const variant = variantMap[type] ?? '';
  18. if (type === 'standard') {
  19. const tile = createElement('div', ['tile', 'mini-teaser', type, variant], null);
  20. // tile.href = link;
  21. const textBox = createElement('div', ['text-box'], null, tile);
  22. createElement('div', ['category','like-h5'], category, textBox);
  23. createElement('div', ['title','like-h4'], title, textBox);
  24. const teaserLink = createElement('a', ['teaser--link'], '', tile);
  25. teaserLink.href = link;
  26. teaserLink.setAttribute('aria-label', 'Beschreibender Link-Text');
  27. return tile;
  28. } else {
  29. const tile = createElement('div', ['tile', 'mini-teaser', type, variant], null);
  30. // tile.href = link;
  31. if (backgroundImage && backgroundImage.length > 0) {
  32. tile.style = 'background-image: url(' + backgroundImage + ');';
  33. tile.classList.add('background-image');
  34. }
  35. const textBox = createElement('div', ['text-box'], null, tile);
  36. if (icon && icon.length > 0) {
  37. createElement('div', ['icon-box', 'pictogram-' + icon.toLowerCase().split(' ').join('-')], null, textBox);
  38. createElement('div', ['title','like-h4'], title, textBox);
  39. textBox.appendChild(createButton({elementType: 'span',color: 'white', label: buttonlabel,iconPosition: 'icon-right', icon: null, preventClick: false}))
  40. } else {
  41. createElement('div', ['title', 'noicon', 'like-h4'], title, textBox);
  42. textBox.appendChild(createButton({elementType: 'span',color: 'white', label: buttonlabel, iconPosition: 'icon-right', icon: null, preventClick: false}))
  43. }
  44. const teaserLink = createElement('a', ['teaser--link'], '', tile);
  45. teaserLink.href = link;
  46. teaserLink.setAttribute('aria-label', 'Beschreibender Link-Text');
  47. return tile;
  48. }
  49. }