1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| import React, {Component} from 'react';
import { Button, Select } from 'semantic-ui-react';
import './recherche.css';
class Recherche extends Component {
state = {
dpt : '',
type : ''
}
onDptChange = (e, data) => {
this.setState({dpt : data.value})
}
onTypeChange = (e, data) => {
this.setState({type : data.value})
}
render(){
const optionDpt = [
{value: "76", key: "76", text: "Seine-Maritime"},
{value: "27", key: "27", text: "Eure"},
{value: "14", key: "14", text: "Calvados"},
{value: "75", key: "75", text: "Paris"},
];
const optionsType = [
{ value: "cpam", key:"cpam", text: "Caisse primaire dassurance maladie (CPAM)"},
{ value: "cci", key:"cci", text: "Chambre de commerce et dindustrie (CCI)"},
{ value: "crous", key:"crous", text: "CROUS et ses antennes"}
]
return(
<div className="recherche">
<Select placeholder="Choisissez un département" onChange={this.onDptChange} options={optionDpt} value={this.state.dpt} />
<Select placeholder="Choisissez une administration" onChange={this.onTypeChange} options={optionsType} value={this.state.type} />
<Button primary onClick={() => this.props.onSearch(this.state.dpt, this.state.type)}>Lancer la recherche</Button>
<Button secondary onClick={this.props.onEmpty}>Vider la recherche</Button>
</div>
)
}
}
export default Recherche; |
Partager