-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react/DP-13169: Add default header search behavior. #519
base: develop
Are you sure you want to change the base?
react/DP-13169: Add default header search behavior. #519
Conversation
|
||
render() { | ||
const headerSearch = this.props; | ||
const orgDropdown = headerSearch.orgDropdown; | ||
const shouldShowTypeAhead = (orgDropdown && orgDropdown.dropdownButton && orgDropdown.inputText); | ||
const { onClick, ...buttonSearchRest } = headerSearch.buttonSearch; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good!, should we remove onSubmit since we decide not to use it
* @param {object} event - The click event. | ||
* @param {string} query - The current query string input. | ||
*/ | ||
this.props.buttonSearch.onClick({ event: e, query: this.state.value }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not be passing the event as it will have expired for whatever set buttonSearch.onClick.
* @param {string} query - The current query string input. | ||
*/ | ||
this.props.buttonSearch.onClick({ event: e, query: this.state.value }); | ||
} else if (this.state.value && this.state.value.length > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else if (this.state.value && this.state.value.length > 0) { | |
} else if (this.state.value && !is.empty(this.state.value)) { |
@@ -55,7 +73,10 @@ class HeaderSearch extends React.Component { | |||
<div className="ma__header-search__post-filter"> | |||
{this.props.postInputFilter} | |||
</div> | |||
<ButtonWithIcon {...headerSearch.buttonSearch} /> | |||
<ButtonWithIcon | |||
onClick={(e) => this.handleClick(e)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onClick={(e) => this.handleClick(e)} | |
onClick={this.handleClick} |
Co-Authored-By: avrilpearl <[email protected]>
Co-Authored-By: avrilpearl <[email protected]>
Co-Authored-By: avrilpearl <[email protected]>
Adds default behaviour, if an onClick buttonSearch prop is not passed to the headerSearch molecule - redirects on click to search.mass.gov.
For storybook - test this in the iframe story by commenting --> e.g. http://localhost:6006/iframe.html?id=molecules-headersearch--headersearch
Note: will need to comment out the story
action