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';
import { bindActionCreators } from 'redux';
import { reduxForm } from 'redux-form';
import {translate} from 'react-i18next';
import { Link } from 'react-router-dom';
import { ACCESSION_FILTERFORM } from 'accessions/constants';
......@@ -17,6 +18,9 @@ import DateFilter from 'ui/common/filter/DateFilter';
import BooleanFilter from 'ui/common/filter/BooleanFilter';
import { autocomplete } from 'accessions/actions/public';
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}) => {
// console.log('AccessionFilters', initialValues);
......@@ -34,6 +38,15 @@ const AccessionFilters = ({handleSubmit, initialValues, initialize, filterCode,
label={ t('accessions.public.f._text') }
placeholder={ t('accessions.public.f._textPlaceholder') }
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
filterCode={ filterCode }
......
......@@ -12,6 +12,7 @@ interface ITextFilterInternal extends React.ClassAttributes<any> {
placeholder?: string;
hint?: any;
t: any;
endAdornment?: any;
}
class TextFilterInternal extends React.Component<ITextFilterInternal, any> {
......@@ -40,7 +41,7 @@ class TextFilterInternal extends React.Component<ITextFilterInternal, any> {
}
public render() {
const { label, placeholder, t, hint } = this.props;
const { label, placeholder, t, hint, endAdornment } = this.props;
return (
<FormControl fullWidth>
<TextField
......@@ -49,6 +50,7 @@ class TextFilterInternal extends React.Component<ITextFilterInternal, any> {
value={ this.state.text }
placeholder={ t(placeholder) }
onChange={ this.handleChange }
InputProps={ {endAdornment} }
/>
{ hint && <FormHelperText>
<span>{ hint }</span>
......@@ -63,13 +65,14 @@ interface ITextFilter extends React.ClassAttributes<any> {
label: string;
placeholder?: string;
className?: string;
endAdornment?: any;
t: any;
}
class TextFilter extends React.Component<ITextFilter, any> {
public render() {
const { name , label, className, t, ...other } = this.props;
const { name , label, className, t, endAdornment, ...other } = this.props;
return (
<div className={ className }>
<Field
......@@ -77,6 +80,7 @@ class TextFilter extends React.Component<ITextFilter, any> {
component={ TextFilterInternal }
label={ t(label) }
t={ t }
endAdornment={ endAdornment }
{ ...other }
/>
</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