refactor: SearchForm component

This commit is contained in:
Francesco Esposito 2019-07-31 15:55:36 +02:00
parent 4e146f4dd5
commit 53f7bda915
1 changed files with 28 additions and 36 deletions

View File

@ -1,4 +1,4 @@
import React, { Component } from 'react';
import React from 'react';
import {
Row,
Col,
@ -15,41 +15,33 @@ const style = {
backgroundImage: 'linear-gradient(to left, #0eaed3, #8346f6)',
}
class SearchForm extends Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
return (
<div>
<Form onSubmit={this.props.onSubmit}>
<Row form>
<Col md={12}>
<FormGroup>
<InputGroup>
<Input
type="input"
name={this.props.name}
id={this.props.id}
placeholder={this.props.placeholder}
onChange={this.props.onChange}
value={this.props.ticketId}
/>
<InputGroupAddon addonType="append">
<Button type="submit" style={style}>
{this.props.buttonName}</Button>
</InputGroupAddon>
</InputGroup>
</FormGroup>
</Col>
</Row>
</Form>
</div>
);
}
const SearchForm = (props) => {
return (
<div>
<Form onSubmit={props.onSubmit}>
<Row form>
<Col md={12}>
<FormGroup>
<InputGroup>
<Input
type="input"
name={props.name}
id={props.id}
placeholder={props.placeholder}
onChange={props.onChange}
value={props.ticketId}
/>
<InputGroupAddon addonType="append">
<Button type="submit" style={style}>
{props.buttonName}</Button>
</InputGroupAddon>
</InputGroup>
</FormGroup>
</Col>
</Row>
</Form>
</div>
);
}
export default SearchForm;