|
|
|
@@ -4,8 +4,14 @@ import Select from 'react-select' |
|
|
|
import { prices, beds, types, lifeStyles } from '../../constants/filters'; |
|
|
|
import './CreateScrapeRequest.scss' |
|
|
|
import PropTypes from 'prop-types'; |
|
|
|
import { states } from '../../constants/states' |
|
|
|
import Autocomplete from 'react-autocomplete'; |
|
|
|
|
|
|
|
|
|
|
|
export function matchStateToTerm(state, value) { |
|
|
|
return ( |
|
|
|
state.label.toLowerCase().indexOf(value.toLowerCase()) !== -1 |
|
|
|
) |
|
|
|
} |
|
|
|
const CreateScrapeRequest = ({ handleRequest }) => { |
|
|
|
|
|
|
|
const { t } = useTranslation(); |
|
|
|
@@ -34,11 +40,24 @@ const CreateScrapeRequest = ({ handleRequest }) => { |
|
|
|
<form > |
|
|
|
<div className="card-body"> |
|
|
|
<div className="row"> |
|
|
|
<div className="col-md-3"> |
|
|
|
{/* <div className="col-md-3"> |
|
|
|
<div className="form-group"> |
|
|
|
<input type="text" className="form-control input-field cursor-pointer" value={requestObject.location} placeholder={t('createScrapeRequest.LocationPlaceholder')} onChange={e => setRequestObject(s => ({ ...s, location: e.target.value }))} /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> */} |
|
|
|
<Autocomplete |
|
|
|
getItemValue={(item) => item.label} |
|
|
|
items={states.map(s => ({ label: s }))} |
|
|
|
renderItem={(item, isHighlighted) => |
|
|
|
<div style={{ background: isHighlighted ? 'lightgray' : 'white' }}> |
|
|
|
{item.label} |
|
|
|
</div> |
|
|
|
} |
|
|
|
shouldItemRender={matchStateToTerm} |
|
|
|
value={requestObject.location} |
|
|
|
onChange={(e, val) => setRequestObject(s => ({ ...s, location: val }))} |
|
|
|
onSelect={(val) => setRequestObject(s => ({ ...s, location: val }))} |
|
|
|
/> |
|
|
|
<div className="col-md-2"> |
|
|
|
<div className="form-group"> |
|
|
|
<Select options={prices} value={{ name: requestObject.price, label: requestObject.price }} onChange={handleChangePriceType} /> |