Filters.tsx 1.3 KB
Newer Older
Matija Obreza's avatar
Subsets  
Matija Obreza committed
1 2 3
import * as React from 'react';
import { reduxForm } from 'redux-form';

4
import { SUBSET_FILTERFORM } from 'subsets/constants';
Matija Obreza's avatar
Subsets  
Matija Obreza committed
5 6 7 8 9

import FiltersBlock from 'ui/common/filter/FiltersBlock';
import CollapsibleComponentSearch from 'ui/common/filter/CollapsibleComponentSearch';
import StringFilter from 'ui/common/filter/StringFilter';
import StringArrFilter from 'ui/common/filter/StringArrFilter';
10
import CropFilter from 'crop/ui/c/CropFilter';
Matija Obreza's avatar
Subsets  
Matija Obreza committed
11 12 13 14 15 16 17 18 19 20

const SubsetFilters = ({handleSubmit, initialValues, initialize, ...other}) => {
  // console.log('SubsetFilters', initialValues);
  return (
    <FiltersBlock title="Filter subsets" handleSubmit={ handleSubmit } initialize={ initialize } { ...other }>
      <CollapsibleComponentSearch title="Text search">
        <StringFilter name="title" searchType="contains" label="Title" placeholder="International"/>
        <StringFilter name="description" searchType="contains" label="Description" placeholder="Subset description"/>
        <StringArrFilter name="institutes" label="Institute" placeholder="MEX002"/>
      </CollapsibleComponentSearch>
Matija Obreza's avatar
Matija Obreza committed
21 22 23
      <CollapsibleComponentSearch title="Crop">
          <CropFilter />
      </CollapsibleComponentSearch>
Matija Obreza's avatar
Subsets  
Matija Obreza committed
24 25 26 27 28 29 30 31
    </FiltersBlock>
  );
};

export default reduxForm({
    enableReinitialize: true,
    form: SUBSET_FILTERFORM,
})(SubsetFilters);