7.3.0 • Published 4 years ago

@domain-group/fe-pa-trade-search-results v7.3.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

fe-pa-trade-search-results Circle CI

The search results page used by Find an Agent.

Screenshot

View demo on fe-dora.

Usage

yarn add @domain-group/fe-pa-trade-search-results
import { TradeSearchResults } from '@domain-group/fe-pa-trade-search-results';

<TradeSearchResults
  initialFetchState
  initialViewState
  searchHeader
/>

PropTypes

This component is enhanced by a Recompose higher-order component (HOC) which is responsible for adding state and lifecycle methods to the base component, and may require additional props that are not declared in the base component if it doesn't explicitly require them. Below is the definitive list of props required for the component to render.

For more information about Recompose, check out Recompose on GitHub.

PropTypeDefaultDescriptionRequired
initialFetchStatearrayN/ARequired by Recompose. An object that defines only the initial fetch state (search results and metadata) of props.fetchState in the base component. Subsequent changes to props.fetchState are managed client-side by event handlers defined in Recompose in response to UI changes, such as filtering or sorting. See PropTypes for fe-co-trade-profile-card for the expected object shape.Yes
initialViewStateobjectN/ARequired by Recompose. An objects that defines only the initial state of props.viewState in the base component. Subsequent changes to props.viewState are managed client-side by event handlers defined in Recompose in response to UI changes, such as filtering or sorting.Yes
searchHeaderobjectN/AAn object consisting of props for components/search-header. See below for the individual object properties.Yes
searchHeader.searchTypestringN/AA string that defines the search type; valid values are declared at constants.AGENCY and constants.AGENT.Yes
searchHeader.selectedSuburbsarrayN/AAn array of objects that defines the selected suburb(s) in both the header text and fe-co-find-an-agent-autocomplete . See PropTypes defined in the header component at src/js/components/search-header.js for the expected object shape.Yes
searchHeader.totalResultsobjectN/AAn object containing the total number of results across all search types for the selected suburb(s). See PropTypes for fe-pa-trade-search-results for the expected object shape.Yes
statsAddressstringN/Agroup stats endpointYes
locationIdstringN/AlocationId for tracking, in format suburbId_postcodeYes
pageIdstringN/Apage id for trackingYes
pageNamestringN/Apage name for trackingNo

For more details, see src/js/trade-search-results.js

Code Architecture

Check out the fe-boilerplate-generator@7.6.3 docs for info on the repo layout, structure and meaning.

Component Architecture

src/enhance/index.js

Composes and exports the Recompose HOC.

src/enhance/lifecycle.js

Defines the HOC's lifecycle methods, such as componentDidMount().

src/enhance/set-prop-types.js

Defines additional PropTypes as required by the Recompose HOC, but not the base component.

PropTypeDefaultDescriptionRequired
initialFetchStatearrayN/AAn object that defines only the initial state of props.fetchState in the base component. Subsequent changes to props.fetchState are managed client-side by event handlers defined in Recompose in response to UI changes, such as filtering or sorting.Yes
initialViewStatearrayN/AAn object defines only the initial state of props.viewState in the base component. Subsequent changes to props.viewState are managed client-side by an event handler defined in Recompose in response to selecting Grid or List viewYes

src/enhance/with-handlers.js

Defines event handlers that update the component state and/or fetch new search results in response to UI changes, such as filtering and sorting.

src/enhance/with-state.js

Defines the component's state and state handlers, accessible as props from the base component and/or event handlers.

fetchState

Updated using setFetchState. Initial state is defined via props.initialFetchState using an identical object format.

viewState

Updated using setViewState. Initial state is defined via props.initialViewState using an identical object format.

src/utils/get-filter-options.js

Returns a list of filter options for use in the applicable dropdown menu.

src/utils/get-header-text.js

Returns a string from a given object argument, as defined below. Defines the title text as visible at the top of the page.

KeyTypeDefault ValueDescriptionRequired
searchTypestringN/AThe string at props.searchType.Yes
selectedSuburbsboolN/AThe object at props.selectedSuburbs.Yes

src/utils/get-sort-options.js

Returns a list of sort options for use in the applicable dropdown menu.

src/utils/transform-selected-suburbs.js

Transforms the object at props.selectedSuburbs into a format compatible with fe-co-find-an-agent-autocomplete.

src/js/constants.js

This component is heavily reliant on string values in its conditional logic and query string behaviour. To avoid bugs arising from the use of 'magic strings', any such strings that affect the behaviour of the component are defined in this file as constants and explicitly imported where applicable.

In some instances, these constants may also used as object keys as the key names may need to vary depending on these values. See src/js/enhance/with-handlers.js for some notable examples of this behaviour when the query string is to be updated as the result of a UI change.

src/js/trade-search-results.js

The enhanced component to be rendered. Also exports the pure base component as BaseComponent for Enzyme testing purposes.

Changes and history

See CHANGELOG.md.

7.3.0

4 years ago

7.2.5

4 years ago

7.2.4

4 years ago

7.2.3

4 years ago

7.2.2

4 years ago

7.2.1

4 years ago

7.2.0

4 years ago

7.1.1

4 years ago

7.1.0

4 years ago

7.0.6

4 years ago

7.0.5

4 years ago

7.0.4

4 years ago

7.0.3

4 years ago

7.0.2

4 years ago

7.0.0

4 years ago

6.0.0

4 years ago

5.5.14

4 years ago

5.5.13

5 years ago

5.5.12

5 years ago

5.5.11

5 years ago

5.5.10

5 years ago

5.5.9

5 years ago

5.5.8

5 years ago

5.5.7

5 years ago

5.5.6

5 years ago

5.5.5

5 years ago

5.5.4

5 years ago

5.5.3

5 years ago

5.5.2

5 years ago

5.5.1

5 years ago

5.5.0

5 years ago

5.4.4

5 years ago

5.4.3

5 years ago

5.4.2

5 years ago

5.4.1

5 years ago

5.4.0

5 years ago

5.3.0

5 years ago

5.2.1

5 years ago

5.2.0

5 years ago

5.1.0

5 years ago

5.0.0

5 years ago

4.4.1

5 years ago

4.2.3

6 years ago

4.2.2

6 years ago

4.2.1

6 years ago

4.2.0

6 years ago

4.1.3

6 years ago

4.1.2

6 years ago

4.1.1

6 years ago

4.1.0

6 years ago

4.0.0-10

6 years ago

4.0.0-9

6 years ago

4.0.0-8

6 years ago

4.0.0-7

6 years ago

4.0.0-6

6 years ago

4.0.0-5

6 years ago

4.0.0-4

6 years ago

4.0.0-3

6 years ago

3.7.3

6 years ago

4.0.0-2

6 years ago

4.0.0-1

6 years ago

4.0.0-0

6 years ago

3.7.2

6 years ago

8.1.2-beta.1

6 years ago

3.7.1

6 years ago

3.7.0

6 years ago

3.6.7

6 years ago

3.6.6

6 years ago

3.6.5

6 years ago

3.6.4

6 years ago

3.6.3

6 years ago

3.6.2

6 years ago

3.6.1

6 years ago

3.6.0

6 years ago

3.5.8

6 years ago

3.5.7

6 years ago

3.5.6

6 years ago

3.5.5

6 years ago

3.5.4

6 years ago

3.5.3

6 years ago

3.5.2

6 years ago

3.5.1

6 years ago

3.5.0

6 years ago

3.4.2

6 years ago

3.4.1

6 years ago

3.4.0

6 years ago

3.3.0

6 years ago

3.2.13

6 years ago

3.2.12

6 years ago

3.2.11

6 years ago

3.2.10

6 years ago

3.2.9

6 years ago

3.2.8

6 years ago

3.2.7

6 years ago

3.2.6

6 years ago

3.2.5

6 years ago

3.2.4

6 years ago

3.2.3

6 years ago

3.2.2

6 years ago

3.2.1

6 years ago

3.2.0

6 years ago

3.1.0

6 years ago

3.0.12

6 years ago

3.0.11

6 years ago

3.0.10

6 years ago

3.0.9

6 years ago

3.0.8

6 years ago

3.0.7

6 years ago

3.0.6

6 years ago

3.0.5

6 years ago

3.0.4

6 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.8.2

6 years ago

2.8.1

6 years ago

2.8.0

6 years ago

2.7.0

6 years ago

2.6.7

6 years ago

2.6.6

6 years ago

2.6.5

6 years ago

2.6.4

6 years ago

2.6.3

6 years ago

2.6.2

6 years ago

2.6.1

6 years ago

2.6.0

6 years ago

2.5.5

6 years ago

2.5.4

6 years ago

2.5.3

6 years ago

2.5.2

6 years ago

2.5.1

6 years ago

2.5.0

6 years ago

2.4.2

6 years ago

2.4.1

6 years ago

2.4.0

6 years ago

2.3.0

6 years ago

2.2.0

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago