mirror of https://github.com/franjsco/tick3t
refactor: Dropdown component
This commit is contained in:
parent
289f01a359
commit
a7ce3013ab
|
@ -1,32 +1,24 @@
|
||||||
import React, { Component } from 'react';
|
import React from 'react';
|
||||||
import { Input } from 'reactstrap';
|
import { Input } from 'reactstrap';
|
||||||
|
|
||||||
|
|
||||||
class DropDown extends Component {
|
const DropDown = (props) => {
|
||||||
constructor(props) {
|
let options = props.options;
|
||||||
super(props);
|
|
||||||
|
|
||||||
this.state = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
let options = this.props.options;
|
|
||||||
options = options.map((opt) => {
|
options = options.map((opt) => {
|
||||||
return <option key={opt.name} value={opt.name}>{opt.value}</option>
|
return <option key={opt.name} value={opt.name}>{opt.value}</option>
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Input
|
<Input
|
||||||
name = {this.props.name}
|
name={props.name}
|
||||||
type="select"
|
type="select"
|
||||||
value = { this.props.value }
|
value={props.value}
|
||||||
onChange = { this.props.onChange }
|
onChange={props.onChange}
|
||||||
>
|
>
|
||||||
<option value="">---</option>
|
<option value="">---</option>
|
||||||
{options}
|
{options}
|
||||||
</Input>
|
</Input>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
export default DropDown;
|
export default DropDown;
|
Loading…
Reference in New Issue