1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { connect } from 'react-redux';
6 import { RootState } from '~/store/store';
7 import { Dispatch } from 'redux';
8 import { goToView, searchData, searchBarActions } from '~/store/search-bar/search-bar-actions';
9 import { SearchBarView } from '~/views-components/search-bar/search-bar-view';
11 const mapStateToProps = ({ searchBar }: RootState) => {
13 searchValue: searchBar.searchValue,
14 currentView: searchBar.currentView,
16 searchResults: searchBar.searchResults
20 const mapDispatchToProps = (dispatch: Dispatch) => ({
21 onSearch: (valueSearch: string) => dispatch<any>(searchData(valueSearch)),
22 onSetView: (currentView: string) => dispatch(goToView(currentView)),
23 openView: () => dispatch<any>(searchBarActions.OPEN_SEARCH_VIEW()),
24 closeView: () => dispatch<any>(searchBarActions.CLOSE_SEARCH_VIEW())
27 export const SearchBar = connect(mapStateToProps, mapDispatchToProps)(SearchBarView);