interface TextInputProps {
placeholder?: string;
customId?: string;
label?: string;
style?: TextInputStyle;
required?: boolean;
minLength?: number;
maxLength?: number;
}
class TextInput {
private text: TextInputBuilder;
constructor(props: TextInputProps) {
this.text = new TextInputBuilder();
this.setParameters(props);
}
public get(): TextInputBuilder {
return this.text;
}
private setParameters(props: TextInputProps) {
const functionsObject = {
'placeholder': this.text.setPlaceholder,
'customId': this.text.setCustomId,
'label': this.text.setLabel,
'style': this.text.setStyle,
'required': this.text.setRequired,
'minLength': this.text.setMinLength,
'maxLength': this.text.setMaxLength,
};
for (const [key, value] of Object.entries(props)) {
if (key && value) {
console.log(`key: ${key}, value: ${value}`);
functionsObject[key](value);
}
}
}
}