forked from inveniosoftware/react-invenio-app-ils
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- upgrade react-searchkit 1.0.0-alpha.3 - removed buttonColor, never used, and in case we use it, it has no effect since its overridden by the .ui.input.action.ils-searchbar styles - subtitle to SearchError as child - simplified search message when empty results - Decoupled QueryBuildHelper to a stand alone component connected to RSK state - fix bug in PatronResultList, when we had empty results, there were displayed two empty results message boxes - remove RSK override - configure with props React Search Kit Search bar - SearchBarILS our simplified not connected to RSK searchbar - fixed issue with configuration on BucketAggregations - SearchBarILS replacing individual searchbars - fixed missing identifiers for all <Identifiers> - fixed empty results in series literature mobile was disconnected from RSK - depends on inveniosoftware/react-searchkit#141 - closes inveniosoftware#226
- Loading branch information
Showing
41 changed files
with
397 additions
and
697 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import PropTypes from 'prop-types'; | ||
import React, { Component } from 'react'; | ||
import { Input } from 'semantic-ui-react'; | ||
|
||
export class SearchBarILS extends Component { | ||
state = { currentValue: '' }; | ||
|
||
componentDidMount() { | ||
if (this.focusInput) { | ||
this.focusInput.focus(); | ||
} | ||
} | ||
|
||
onKeyPressHandler = (event, input) => { | ||
if (event.key === 'Enter') { | ||
const { onSearchHandler } = this.props; | ||
const { currentValue } = this.state; | ||
onSearchHandler(currentValue); | ||
} | ||
}; | ||
|
||
onPasteHandler = event => { | ||
const { onSearchHandler } = this.props; | ||
const queryString = (event.clipboardData || window.clipboardData).getData( | ||
'text' | ||
); | ||
onSearchHandler(queryString); | ||
}; | ||
|
||
render() { | ||
const { | ||
className: parentClass, | ||
onKeyPressHandler: parentKeyPressHandler, | ||
onSearchHandler, | ||
onPasteHandler, | ||
placeholder, | ||
...rest | ||
} = this.props; | ||
const { currentValue } = this.state; | ||
return ( | ||
<Input | ||
action={{ | ||
icon: 'search', | ||
onClick: () => onSearchHandler(currentValue), | ||
}} | ||
onChange={(event, { value }) => { | ||
this.setState({ currentValue: value }); | ||
}} | ||
onKeyPress={parentKeyPressHandler || this.onKeyPressHandler} | ||
onPaste={onPasteHandler || this.onPasteHandler} | ||
fluid | ||
size="big" | ||
placeholder={placeholder} | ||
className={`${parentClass} ils-searchbar`} | ||
ref={input => { | ||
this.focusInput = input; | ||
}} | ||
{...rest} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
SearchBarILS.propTypes = { | ||
onKeyPressHandler: PropTypes.func, | ||
onPasteHandler: PropTypes.func, | ||
onSearchHandler: PropTypes.func.isRequired, | ||
placeholder: PropTypes.string, | ||
className: PropTypes.string, | ||
}; | ||
|
||
SearchBarILS.defaultProps = { | ||
onKeyPressHandler: null, | ||
onPasteHandler: null, | ||
placeholder: '', | ||
className: '', | ||
}; |
Oops, something went wrong.