mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 15:35:49 +01:00
initial styling
This commit is contained in:
49
scm-ui/src/components/InputField.js
Normal file
49
scm-ui/src/components/InputField.js
Normal file
@@ -0,0 +1,49 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import Image from "../images/logo.png";
|
||||
|
||||
type Props = {
|
||||
label?: string,
|
||||
placeholder?: string,
|
||||
type?: string,
|
||||
onChange: string => void
|
||||
};
|
||||
|
||||
class InputField extends React.Component<Props> {
|
||||
static defaultProps = {
|
||||
type: "text",
|
||||
placeholder: ""
|
||||
};
|
||||
|
||||
handleInput = (event: SyntheticInputEvent<HTMLInputElement>) => {
|
||||
this.props.onChange(event.target.value);
|
||||
};
|
||||
|
||||
renderLabel = () => {
|
||||
const label = this.props.label;
|
||||
if (label) {
|
||||
return <label class="label">{label}</label>;
|
||||
}
|
||||
return "";
|
||||
};
|
||||
|
||||
render() {
|
||||
const { type, placeholder } = this.props;
|
||||
|
||||
return (
|
||||
<div class="field">
|
||||
{this.renderLabel()}
|
||||
<div class="control">
|
||||
<input
|
||||
class="input"
|
||||
type={type}
|
||||
placeholder={placeholder}
|
||||
onChange={this.handleInput}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default InputField;
|
||||
Reference in New Issue
Block a user