Merge branch 'master' of git.curoverse.com:arvados-workbench2 into 14307-search-basic...
[arvados.git] / src / views-components / search-bar / search-bar.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { connect } from 'react-redux';
6 import { RootState } from '~/store/store';
7 import { Dispatch } from 'redux';
8 import { goToView, searchBarActions } from '~/store/search-bar/search-bar-actions';
9 import { SearchBarView } from '~/views-components/search-bar/search-bar-view';
10
11 const mapStateToProps = ({ searchBar }: RootState) => {
12     return {
13         currentView: searchBar.currentView,
14         open: searchBar.open
15     };
16 };
17
18 const mapDispatchToProps = (dispatch: Dispatch) => ({
19     onSetView: (currentView: string) => dispatch(goToView(currentView)),
20     openView: () => dispatch<any>(searchBarActions.OPEN_SEARCH_VIEW()),
21     closeView: () => dispatch<any>(searchBarActions.CLOSE_SEARCH_VIEW())
22 });
23
24 export const SearchBar = connect(mapStateToProps, mapDispatchToProps)(SearchBarView);