import React from 'react';
import { Col ,Row , Input} from 'react-materialize';
import Modularity from 'modularity-front';
import SearchBar from '../searchbar';
import './Filter.css';
import Checkbox from '@material-ui/core/Checkbox';
import FormControlLabel from '@material-ui/core/FormControlLabel';
const Module = Modularity.Module;


class SearchFilter extends Modularity.Module {
	constructor(props){
		super(props);
    this.state = {
      ...props.filter,
      values: [props.filter.defaultValue || ""]
    }
  }

	checkFilter = (value) => {
    let values =  value === undefined ? [this.props.filter.defaultValue] : [value];
    this.setState({values});
    this.Filters.set({...this.state,values});
  }

	render(){
    return(

			<div className='flex-search'>
        <div>
          {this.filter.value.name}
        </div>
		  	<SearchBar SearchBar={{defaultValue:this.filter.value.defaultValue, placeholder: this.filter.value.name}} SearchData={(data) => this.checkFilter(data)}             />
			</div>
		)
	}
}

SearchFilter.Inputs = {
      filter:{
        type:Module.Types.Object,

      }
}

SearchFilter.Outputs = {
      Filters:{

      }
}
SearchFilter.Category = 'sxoinas'

export default SearchFilter;
