homeflowjs 1.0.51 → 1.0.53

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.51",
3
+ "version": "1.0.53",
4
4
  "sideEffects": [
5
5
  "modal/**/*",
6
6
  "user/default-profile/**/*",
@@ -10,7 +10,8 @@
10
10
  "properties/property-streetview/**/*",
11
11
  "properties/stamp-duty-calculator/**/*",
12
12
  "search/range-controller/**/*",
13
- "properties/property-results-pagination/**/*"
13
+ "properties/property-results-pagination/**/*",
14
+ "shared/loading-icon/**/*"
14
15
  ],
15
16
  "description": "JavaScript toolkit for Homeflow themes",
16
17
  "main": "index.js",
@@ -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 {
@@ -18,6 +18,7 @@ const AddressLookupInput = ({
18
18
  required,
19
19
  setSelectedAddress,
20
20
  iconStokeInherit,
21
+ errorMessage
21
22
  }) => {
22
23
  const [locationQuery, setLocationQuery] = useState('');
23
24
  const [suggestions, setSuggestions] = useState([]);
@@ -35,7 +36,7 @@ const AddressLookupInput = ({
35
36
  if (json.suggestions.length === 0) {
36
37
  setAddress({
37
38
  value: address.value,
38
- error: 'Sorry we couldn\'t find that address',
39
+ error: errorMessage,
39
40
  });
40
41
  }
41
42
  if (json.suggestions.length !== 0) {
@@ -194,6 +195,7 @@ AddressLookupInput.propTypes = {
194
195
  className: PropTypes.string,
195
196
  setSelectedAddress: PropTypes.func,
196
197
  iconStokeInherit: PropTypes.bool,
198
+ errorMessage: PropTypes.node,
197
199
  };
198
200
 
199
201
  AddressLookupInput.defaultProps = {
@@ -204,6 +206,7 @@ AddressLookupInput.defaultProps = {
204
206
  className: '',
205
207
  setSelectedAddress: null,
206
208
  iconStokeInherit: true,
209
+ errorMessage: <span className="input__error">Sorry we couldn't find that address</span>,
207
210
  };
208
211
 
209
212
  export default AddressLookupInput;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import SearchIcon from '../../shared/search-icon.component';
4
4
  import CloseIcon from '../../shared/close-icon.component';
5
- import LoadingIcon from '../../shared/loading-icon.component';
5
+ import LoadingIcon from '../../shared/loading-icon/loading-icon.component';
6
6
 
7
7
  const ClearButton = ({ address, loading, onClear, iconStokeInherit }) => (
8
8
  <button
@@ -44,9 +44,7 @@ const Input = ({
44
44
  />
45
45
  <ClearButton address={address} loading={loading} onClear={onClear} iconStokeInherit={iconStokeInherit} />
46
46
  </div>
47
- {address?.error && typeof (address.error) === 'string' && (
48
- <span className="input__error">{address.error}</span>
49
- )}
47
+ {address?.error && address.error}
50
48
  </div>
51
49
  );
52
50
 
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,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import './loading-icon.styles.scss';
3
4
 
4
5
  const LoadingIcon = ({inherit}) => (
5
6
  <svg role="img" className="loading-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -0,0 +1,13 @@
1
+ @keyframes spin-loading-icon {
2
+ from {
3
+ transform: rotate(0deg);
4
+ }
5
+ to {
6
+ transform: rotate(360deg);
7
+ }
8
+ }
9
+
10
+ .loading-icon {
11
+ transform-origin: center;
12
+ animation: spin-loading-icon 1s linear infinite;
13
+ }