import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Button, Icon } from 'amos-antd';
import './style/filter.scss';

class MoreFilter extends Component {
  constructor(props) {
    super(props);
    // this.state={
    //   btnClass:'close-more-ant-btn'
    // };
  }

  isTextSearch = () => {
    let { filterSearchModel } = this.props;
    let filter = filterSearchModel.filter(e => e.query == true);
    return filter;
  };

  //<Button className={btnClass} onClick={this.props.openFilter}>筛选<Icon type='down' /></Button>
  render() {
    let primaryFilter = this.isTextSearch();
    let btnClass = this.props.showFilter ? 'open-more-ant-btn' : 'close-more-ant-btn';
    let display = primaryFilter.length > 1 ? 'block' : 'none';
    let style = { display: display };
    return <div className="amos-more-filter-content" style={style} />;
  }
}

MoreFilter.propTypes = {
  filterSearchModel: PropTypes.array, //表格列模型，默认值空数组
  openFilter: PropTypes.func,
  showFilter: PropTypes.bool
};

export default MoreFilter;
