homeflowjs 1.0.50 → 1.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,6 +32,11 @@ export const setSearchField = (payload) => ({
32
32
  payload,
33
33
  });
34
34
 
35
+ export const setTextSearch = (payload) => ({
36
+ type: SearchActionTypes.SET_TEXT_SEARCH,
37
+ payload,
38
+ });
39
+
35
40
  export const toggleTag = (payload) => ({
36
41
  type: SearchActionTypes.TOGGLE_TAG,
37
42
  payload,
@@ -2,6 +2,7 @@ const SearchActionTypes = {
2
2
  SET_SEARCH: 'SET_SEARCH',
3
3
  SET_INITIAL_SEARCH: 'SET_INITIAL_SEARCH',
4
4
  SET_SUGGESTIONS: 'SET_SUGGESTIONS',
5
+ SET_TEXT_SEARCH: 'SET_TEXT_SEARCH',
5
6
  SET_CHANNEL: 'SET_CHANNEL',
6
7
  SET_SEARCH_FIELD: 'SET_SEARCH_FIELD',
7
8
  ADD_TAG: 'ADD_TAG',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeflowjs",
3
- "version": "1.0.50",
3
+ "version": "1.0.52",
4
4
  "sideEffects": [
5
5
  "modal/**/*",
6
6
  "user/default-profile/**/*",
@@ -11,6 +11,7 @@ const INITIAL_STATE = {
11
11
  tags: [],
12
12
  poly: '',
13
13
  auctionDate: '',
14
+ text: '',
14
15
  viewport: [],
15
16
  },
16
17
  initialSearch: {}, // original search when the page first loads
@@ -42,6 +43,14 @@ const searchReducer = (state = INITIAL_STATE, action) => {
42
43
  suggestions: action.payload,
43
44
  },
44
45
  };
46
+ case SearchActionTypes.SET_TEXT_SEARCH:
47
+ return {
48
+ ...state,
49
+ currentSearch: {
50
+ ...state.currentSearch,
51
+ text: action.payload,
52
+ },
53
+ };
45
54
  case SearchActionTypes.SET_CHANNEL:
46
55
  // when channel is changed, reset prices to avoid trying to search using wrong prices
47
56
  return {
@@ -16,10 +16,10 @@ const ClearButton = ({ address, loading, onClear, iconStokeInherit }) => (
16
16
  <SearchIcon inherit={iconStokeInherit} />
17
17
  )}
18
18
  {Object.keys(address.value).length !== 0 && !loading && (
19
- <CloseIcon inherit={iconStokeInherit} />
19
+ <CloseIcon inherit={iconStokeInherit} />
20
20
  )}
21
21
  {loading && (
22
- <LoadingIcon inherit={iconStokeInherit} />
22
+ <LoadingIcon inherit={iconStokeInherit} />
23
23
  )}
24
24
  </button>
25
25
  );
package/search/index.js CHANGED
@@ -14,10 +14,12 @@ import RemoveSavedSearchButton from '../properties/remove-saved-property-button/
14
14
  import SavedSearch from './saved-search/saved-search.component';
15
15
  import propertySearch from './property-search/property-search';
16
16
  import generateSearchDescription from './saved-search/generate-description';
17
+ import TextSearchInput from './text-search/text-search.component';
17
18
 
18
19
  export {
19
20
  SearchForm,
20
21
  LocationInput,
22
+ TextSearchInput,
21
23
  AddressLookupInput,
22
24
  BedroomsSelect,
23
25
  ChannelRadioButton,
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import { setTextSearch } from '../../actions/search.actions';
3
+ import { useDispatch, useSelector } from 'react-redux';
4
+ import PropTypes from 'prop-types';
5
+
6
+ const TextSearchInput = ({
7
+ className, placeholder, htmlFor,
8
+ }) => {
9
+ const dispatch = useDispatch();
10
+
11
+ const initialTextSearch = useSelector(state => state.search.currentSearch.text) || '';
12
+
13
+ const handleChange = (e) => {
14
+ dispatch(setTextSearch(e.target.value?.replace('%20', ' ')));
15
+ }
16
+
17
+ return (
18
+ <input
19
+ type="text"
20
+ name="text_search"
21
+ id="text_search"
22
+ value={initialTextSearch?.replace('%20', ' ')}
23
+ {...className && {
24
+ className: className,
25
+ }}
26
+ {...placeholder && {
27
+ placeholder: placeholder,
28
+ }}
29
+ {...htmlFor && {
30
+ htmlFor: htmlFor,
31
+ }}
32
+ onChange={e => handleChange(e)}
33
+ />
34
+ );
35
+ };
36
+
37
+ TextSearchInput.propTypes = {
38
+ className: PropTypes.string,
39
+ placeholder: PropTypes.string,
40
+ htmlFor: PropTypes.string,
41
+ };
42
+
43
+ export default TextSearchInput;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
- const CloseIcon = () => (
4
+ const CloseIcon = ({inherit}) => (
5
5
  <svg role="img" xmlns="http://www.w3.org/2000/svg" width="20.52" height="20.52" viewBox="0 0 20.52 20.52">
6
6
  <title>Close Icon</title>
7
7
  <g transform="translate(-336.011 -145.97)">
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
- const LoadingIcon = () => (
4
+ const LoadingIcon = ({inherit}) => (
5
5
  <svg role="img" className="loading-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
6
6
  <title>Loading Icon</title>
7
7
  <path d="M23 4V10H17" stroke={`${inherit ? 'inherit' : '#fff'}`} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />