1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { Paper, StyleRulesCallback, withStyles, WithStyles } from '@material-ui/core';
8 SearchBarRecentQueries,
9 SearchBarRecentQueriesActionProps
10 } from '~/views-components/search-bar/search-bar-recent-queries';
12 SearchBarSavedQueries,
13 SearchBarSavedQueriesDataProps,
14 SearchBarSavedQueriesActionProps
15 } from '~/views-components/search-bar/search-bar-save-queries';
17 type CssRules = 'advanced' | 'label' | 'root';
19 const styles: StyleRulesCallback<CssRules> = theme => {
22 color: theme.palette.common.black,
23 borderRadius: `0 0 ${theme.spacing.unit / 2}px ${theme.spacing.unit / 2}px`
27 justifyContent: 'flex-end',
28 padding: theme.spacing.unit,
31 color: theme.palette.primary.main
35 padding: `${theme.spacing.unit}px ${theme.spacing.unit}px `,
36 color: theme.palette.grey["900"],
44 export type SearchBarBasicViewDataProps = SearchBarSavedQueriesDataProps;
46 export type SearchBarBasicViewActionProps = {
47 onSetView: (currentView: string) => void;
48 onSearch: (searchValue: string) => void;
49 } & SearchBarRecentQueriesActionProps & SearchBarSavedQueriesActionProps;
51 type SearchBarBasicViewProps = SearchBarBasicViewDataProps & SearchBarBasicViewActionProps & WithStyles<CssRules>;
53 export const SearchBarBasicView = withStyles(styles)(
54 ({ classes, onSetView, loadRecentQueries, deleteSavedQuery, savedQueries, onSearch, editSavedQuery, selectedItem }: SearchBarBasicViewProps) =>
55 <Paper className={classes.root}>
56 <div className={classes.label}>{"Recent queries"}</div>
57 <SearchBarRecentQueries
59 loadRecentQueries={loadRecentQueries}
60 selectedItem={selectedItem} />
61 <div className={classes.label}>{"Saved queries"}</div>
62 <SearchBarSavedQueries
64 savedQueries={savedQueries}
65 editSavedQuery={editSavedQuery}
66 deleteSavedQuery={deleteSavedQuery}
67 selectedItem={selectedItem} />