aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/components/container
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-01-06 12:11:05 +0100
committerNoah Loomans <noahloomans@gmail.com>2018-01-06 12:11:05 +0100
commit95041dffbd23fe81802efd5fb25cffe492cdb551 (patch)
treecb66d325fb5d16d8b7fa0f14c91ad17dd4ff7c6c /src/client/react/components/container
parent4ca30295d7d9f3dd7ba2e105952ff627f6b702a4 (diff)
Revert "Add strict typing"
This reverts commit 4ca30295d7d9f3dd7ba2e105952ff627f6b702a4.
Diffstat (limited to 'src/client/react/components/container')
-rw-r--r--src/client/react/components/container/Search.tsx27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/client/react/components/container/Search.tsx b/src/client/react/components/container/Search.tsx
index b22c26e..fdd6c83 100644
--- a/src/client/react/components/container/Search.tsx
+++ b/src/client/react/components/container/Search.tsx
@@ -13,8 +13,8 @@ import users from '../../users';
import Results from './Results';
import IconFromUserType from '../presentational/IconFromUserType';
-interface SearchStateProps {
- selectedResult: string | null,
+interface SearchStatehProps {
+ selectedResult: string,
isExactMatch: boolean,
}
@@ -23,8 +23,8 @@ interface SearchDispatchProps {
inputChange(typedValue: string): void,
}
-class Search extends React.Component<SearchStateProps & SearchDispatchProps, any> {
- constructor(props: SearchStateProps & SearchDispatchProps) {
+class Search extends React.Component<SearchStatehProps & SearchDispatchProps, any> {
+ constructor(props: SearchStatehProps & SearchDispatchProps) {
super(props);
this.state = {
@@ -80,7 +80,7 @@ class Search extends React.Component<SearchStateProps & SearchDispatchProps, any
<div className="search__input-wrapper">
<div className="search__icon-wrapper">
<IconFromUserType
- userType={(selectedResult && isExactMatch) ? users.byId[selectedResult].type : undefined}
+ userType={isExactMatch ? users.byId[selectedResult].type : null}
defaultIcon={<SearchIcon />}
/>
</div>
@@ -99,11 +99,26 @@ class Search extends React.Component<SearchStateProps & SearchDispatchProps, any
}
}
-const mapStateToProps = (state: State):SearchStateProps => ({
+// Search.propTypes = {
+// selectedResult: PropTypes.string,
+// isExactMatch: PropTypes.bool.isRequired,
+// dispatch: PropTypes.func.isRequired,
+// };
+
+// Search.defaultProps = {
+// selectedResult: null,
+// };
+
+const mapStateToProps = (state: State):SearchStatehProps => ({
selectedResult: state.search.selectedResult,
isExactMatch: state.search.isExactMatch,
});
+// const mapDispatchToProps = {
+// inputChange,
+// changeSelectedResult,
+// };
+
const mapDispatchToProps = (dispatch: any): SearchDispatchProps => ({
inputChange(typedValue) {
dispatch(inputChange(typedValue));