Filters.tsx 1.53 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

Viacheslav Pavlov's avatar
i18n  
Viacheslav Pavlov committed
12
const SubsetFilters = ({handleSubmit, initialValues, initialize, t, ...other}) => {
Matija Obreza's avatar
Subsets  
Matija Obreza committed
13 14
  // console.log('SubsetFilters', initialValues);
  return (
Viacheslav Pavlov's avatar
i18n  
Viacheslav Pavlov committed
15 16 17 18 19
    <FiltersBlock title={ t('subsets.public.f.filterTitle') } handleSubmit={ handleSubmit } initialize={ initialize } { ...other }>
      <CollapsibleComponentSearch title={ t('subsets.public.f.textSearch') }>
        <StringFilter name="title" searchType="contains" label={ t('subsets.public.f.title') } placeholder={ t('subsets.public.f.titlePlaceholder') }/>
        <StringFilter name="description" searchType="contains" label={ t('subsets.public.f.description') } placeholder={ t('subsets.public.f.descriptionPlaceholder') }/>
        <StringArrFilter name="institutes" label={ t('subsets.public.f.institute') } placeholder={ t('subsets.public.f.institutePlaceholder') }/>
Matija Obreza's avatar
Subsets  
Matija Obreza committed
20
      </CollapsibleComponentSearch>
Viacheslav Pavlov's avatar
i18n  
Viacheslav Pavlov committed
21
      <CollapsibleComponentSearch title={ t('subsets.public.f.crop') }>
Matija Obreza's avatar
Matija Obreza committed
22 23
          <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);