import React, { Component } from 'react'
import { Select } from 'antd';
const Option = Select.Option;

class SelectField extends Component {
	render() {
		let {
			value,
			options,
			label
		} = this.props
		options = options && options instanceof Array === true ? options : []
		this.props.selectData.map(elem => {
			if(elem.label === label){
				options = elem.data;
				return options
			}
		})
		value = value && value instanceof Array === true ? value : []
		
		return (
			<Select mode='multiple' value={value} className="rep-u-field-search-select" onChange={value=>this.props.onChange(value)}>
				{
					options.map((item,key)=>(
						<Option key={key} value={item}>{item}</Option>
					))
				}
		    </Select>
		)
	}
}

export default SelectField