You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

49 lines
1.8 KiB

  1. import './election-form.scss';
  2. import {createElement} from "../../_global/scripts/helpers";
  3. import {createInputText} from "../../atoms/input-text/InputTextComponent";
  4. import {createInputSelect} from "../../atoms/input-select/InputSelectComponent";
  5. import {createSearchButton} from "../../atoms/search-button/SearchButtonComponent";
  6. export const createElectionForm =
  7. ({
  8. title = 'Finden Sie die Branchenvertreter:innen Ihrer Region',
  9. backgroundColor = '',
  10. inlineStyles = 'background: ' + backgroundColor + ';',
  11. electionArea = true,
  12. placeholderElectionGroup = 'Wahlgruppe',
  13. placeholderElectionArea = 'Wahlbezirk',
  14. placeholderElectionCompany = 'Suche nach Name oder Firma',
  15. }) => {
  16. const electionForm = createElement('div', ['election-form'], null, null, inlineStyles);
  17. createElement('h2', [], title, electionForm);
  18. const form = createElement('form', ['election-form--form'], null, electionForm);
  19. const selectWrapper = createElement('div', ['input-wrapper'], null, form);
  20. selectWrapper.appendChild(createInputSelect({
  21. placeholder: placeholderElectionGroup,
  22. isRequired: true,
  23. id: 'election-group',
  24. name: 'election-group',
  25. }));
  26. if (electionArea) {
  27. const selectWrapper2 = createElement('div', ['input-wrapper'], null, form);
  28. selectWrapper2.appendChild(createInputSelect({
  29. placeholder: placeholderElectionArea,
  30. isRequired: true,
  31. id: 'election-area',
  32. name: 'election-area',
  33. }));
  34. }
  35. const inputWrapper = createElement('div', ['input-wrapper'], null, form);
  36. inputWrapper.appendChild(createInputText({
  37. placeholder: placeholderElectionCompany,
  38. isRequired: true,
  39. id: 'election-searchstring',
  40. name: 'election-searchstring',
  41. }));
  42. form.appendChild(createSearchButton({btnClass: 'secondary'}));
  43. return electionForm;
  44. }