diff --git a/scm-ui/src/components/forms/Textarea.js b/scm-ui/src/components/forms/Textarea.js new file mode 100644 index 0000000000..3144c00d0c --- /dev/null +++ b/scm-ui/src/components/forms/Textarea.js @@ -0,0 +1,54 @@ +//@flow +import React from "react"; + +export type SelectItem = { + value: string, + label: string +}; + +type Props = { + label?: string, + placeholder?: SelectItem[], + value?: string, + onChange: string => void +}; + +class Textarea extends React.Component { + field: ?HTMLTextAreaElement; + + handleInput = (event: SyntheticInputEvent) => { + this.props.onChange(event.target.value); + }; + + renderLabel = () => { + const label = this.props.label; + if (label) { + return ; + } + return ""; + }; + + render() { + const { placeholder, value } = this.props; + + return ( +
+ {this.renderLabel()} +
+ +
+
+ ); + } +} + +export default Textarea; diff --git a/scm-ui/src/repos/components/RepositoryForm.js b/scm-ui/src/repos/components/RepositoryForm.js index 3c83f88115..92741f1d83 100644 --- a/scm-ui/src/repos/components/RepositoryForm.js +++ b/scm-ui/src/repos/components/RepositoryForm.js @@ -6,6 +6,7 @@ import { SubmitButton } from "../../components/buttons"; import type { Repository } from "../types/Repositories"; import * as validator from "./repositoryValidation"; import type { RepositoryType } from "../types/RepositoryTypes"; +import Textarea from "../../components/forms/Textarea"; type Props = { submitForm: Repository => void, @@ -89,7 +90,7 @@ class RepositoryForm extends React.Component { errorMessage={t("validation.contact-invalid")} /> -