Commit 1090ea33 authored by Viacheslav Pavlov's avatar Viacheslav Pavlov

Merge branch '302-add-to-full-text-search-input' into 'master'

Add ? to full-text search input

Closes #302

See merge request genesys-pgr/genesys-ui!321
parents e6eb655a 99b9e9c9
...@@ -3,6 +3,7 @@ import { connect } from 'react-redux'; ...@@ -3,6 +3,7 @@ import { connect } from 'react-redux';
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import { reduxForm } from 'redux-form'; import { reduxForm } from 'redux-form';
import {translate} from 'react-i18next'; import {translate} from 'react-i18next';
import { Link } from 'react-router-dom';
import { ACCESSION_FILTERFORM } from 'accessions/constants'; import { ACCESSION_FILTERFORM } from 'accessions/constants';
...@@ -17,6 +18,9 @@ import DateFilter from 'ui/common/filter/DateFilter'; ...@@ -17,6 +18,9 @@ import DateFilter from 'ui/common/filter/DateFilter';
import BooleanFilter from 'ui/common/filter/BooleanFilter'; import BooleanFilter from 'ui/common/filter/BooleanFilter';
import { autocomplete } from 'accessions/actions/public'; import { autocomplete } from 'accessions/actions/public';
import TextFilter from 'ui/common/filter/TextFilter'; import TextFilter from 'ui/common/filter/TextFilter';
import IconButton from '@material-ui/core/IconButton';
import InputAdornment from '@material-ui/core/InputAdornment';
import HelpOutlineIcon from '@material-ui/icons/HelpOutline';
const AccessionFilters = ({handleSubmit, initialValues, initialize, filterCode, autocomplete, terms, crops, countryCodes, t, ...other}) => { const AccessionFilters = ({handleSubmit, initialValues, initialize, filterCode, autocomplete, terms, crops, countryCodes, t, ...other}) => {
// console.log('AccessionFilters', initialValues); // console.log('AccessionFilters', initialValues);
...@@ -34,6 +38,15 @@ const AccessionFilters = ({handleSubmit, initialValues, initialize, filterCode, ...@@ -34,6 +38,15 @@ const AccessionFilters = ({handleSubmit, initialValues, initialize, filterCode,
label={ t('accessions.public.f._text') } label={ t('accessions.public.f._text') }
placeholder={ t('accessions.public.f._textPlaceholder') } placeholder={ t('accessions.public.f._textPlaceholder') }
hint={ t('accessions.public.f._textHint') } hint={ t('accessions.public.f._textHint') }
endAdornment={
<InputAdornment position="end">
<Link to="/content/help/how-to-use-genesys">
<IconButton type="button">
<HelpOutlineIcon style={ { fontSize: '1.5rem' } }/>
</IconButton>
</Link>
</InputAdornment>
}
/> />
<AutocompleteFilter <AutocompleteFilter
filterCode={ filterCode } filterCode={ filterCode }
......
...@@ -12,6 +12,7 @@ interface ITextFilterInternal extends React.ClassAttributes<any> { ...@@ -12,6 +12,7 @@ interface ITextFilterInternal extends React.ClassAttributes<any> {
placeholder?: string; placeholder?: string;
hint?: any; hint?: any;
t: any; t: any;
endAdornment?: any;
} }
class TextFilterInternal extends React.Component<ITextFilterInternal, any> { class TextFilterInternal extends React.Component<ITextFilterInternal, any> {
...@@ -40,7 +41,7 @@ class TextFilterInternal extends React.Component<ITextFilterInternal, any> { ...@@ -40,7 +41,7 @@ class TextFilterInternal extends React.Component<ITextFilterInternal, any> {
} }
public render() { public render() {
const { label, placeholder, t, hint } = this.props; const { label, placeholder, t, hint, endAdornment } = this.props;
return ( return (
<FormControl fullWidth> <FormControl fullWidth>
<TextField <TextField
...@@ -49,6 +50,7 @@ class TextFilterInternal extends React.Component<ITextFilterInternal, any> { ...@@ -49,6 +50,7 @@ class TextFilterInternal extends React.Component<ITextFilterInternal, any> {
value={ this.state.text } value={ this.state.text }
placeholder={ t(placeholder) } placeholder={ t(placeholder) }
onChange={ this.handleChange } onChange={ this.handleChange }
InputProps={ {endAdornment} }
/> />
{ hint && <FormHelperText> { hint && <FormHelperText>
<span>{ hint }</span> <span>{ hint }</span>
...@@ -63,13 +65,14 @@ interface ITextFilter extends React.ClassAttributes<any> { ...@@ -63,13 +65,14 @@ interface ITextFilter extends React.ClassAttributes<any> {
label: string; label: string;
placeholder?: string; placeholder?: string;
className?: string; className?: string;
endAdornment?: any;
t: any; t: any;
} }
class TextFilter extends React.Component<ITextFilter, any> { class TextFilter extends React.Component<ITextFilter, any> {
public render() { public render() {
const { name , label, className, t, ...other } = this.props; const { name , label, className, t, endAdornment, ...other } = this.props;
return ( return (
<div className={ className }> <div className={ className }>
<Field <Field
...@@ -77,6 +80,7 @@ class TextFilter extends React.Component<ITextFilter, any> { ...@@ -77,6 +80,7 @@ class TextFilter extends React.Component<ITextFilter, any> {
component={ TextFilterInternal } component={ TextFilterInternal }
label={ t(label) } label={ t(label) }
t={ t } t={ t }
endAdornment={ endAdornment }
{ ...other } { ...other }
/> />
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment