|
- import './input-text.scss';
- import {createElement} from "../../_global/scripts/helpers";
-
- export const createInputText = ({
- type = 'text',
- id = 'username',
- name = 'username',
- isRequired = false,
- placeholder = 'Platzhalter-Text',
- classes = '',
- }) => {
- const input = createElement(type === 'textarea' ? 'textarea' : 'input', classes && classes.length > 0 ? classes.split(' ') : []);
- input.id = id;
- input.name = name;
- input.required = isRequired;
-
- if (placeholder) {
- input.placeholder = placeholder;
- }
- if (type !== 'textarea') {
- input.type = type;
- }
-
- return input;
- }
|