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

25 lines
601 B

  1. import './input-text.scss';
  2. import {createElement} from "../../_global/scripts/helpers";
  3. export const createInputText = ({
  4. type = 'text',
  5. id = 'username',
  6. name = 'username',
  7. isRequired = false,
  8. placeholder = 'Platzhalter-Text',
  9. classes = '',
  10. }) => {
  11. const input = createElement(type === 'textarea' ? 'textarea' : 'input', classes && classes.length > 0 ? classes.split(' ') : []);
  12. input.id = id;
  13. input.name = name;
  14. input.required = isRequired;
  15. if (placeholder) {
  16. input.placeholder = placeholder;
  17. }
  18. if (type !== 'textarea') {
  19. input.type = type;
  20. }
  21. return input;
  22. }