X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/7299f093d4325802cbabf89c0b4861768b19b472..23f12738ed71ef736cb9c85a530cb4795c760d8f:/src/components/search-bar/search-bar.tsx diff --git a/src/components/search-bar/search-bar.tsx b/src/components/search-bar/search-bar.tsx index 366d7056..ebb7f5e9 100644 --- a/src/components/search-bar/search-bar.tsx +++ b/src/components/search-bar/search-bar.tsx @@ -10,22 +10,45 @@ import { withStyles, WithStyles, Tooltip, - InputAdornment, Input + InputAdornment, Input, + List, ListItem, ListItemText, ListItemSecondaryAction } from '@material-ui/core'; import SearchIcon from '@material-ui/icons/Search'; +import { RemoveIcon } from '~/components/icon/icon'; -type CssRules = 'container' | 'input'; +type CssRules = 'container' | 'input' | 'advanced' | 'searchQueryList' | 'list' | 'searchView' | 'searchBar'; const styles: StyleRulesCallback = theme => { return { container: { position: 'relative', - width: '100%' + width: '100%', + borderRadius: '0px' }, input: { border: 'none', - borderRadius: theme.spacing.unit / 4, - padding: `${theme.spacing.unit / 2}px ${theme.spacing.unit}px` + padding: `0px ${theme.spacing.unit}px` + }, + advanced: { + display: 'flex', + justifyContent: 'flex-end', + paddingRight: theme.spacing.unit * 2, + paddingBottom: theme.spacing.unit, + fontSize: '14px' + }, + searchQueryList: { + padding: `${theme.spacing.unit / 2}px ${theme.spacing.unit}px `, + background: '#f2f2f2', + fontSize: '14px' + }, + list: { + padding: '0px' + }, + searchView: { + color: theme.palette.common.black + }, + searchBar: { + height: '30px' } }; }; @@ -43,6 +66,7 @@ type SearchBarProps = SearchBarDataProps & SearchBarActionProps & WithStyles { state: SearchBarState = { - value: "" + value: "", + isSearchViewOpen: false }; timeout: number; render() { const { classes } = this.props; - return -
+ return + @@ -74,7 +101,20 @@ export const SearchBar = withStyles(styles)( - }/> + } /> + {this.state.isSearchViewOpen && +
Saved search queries
+ + {this.renderSavedQueries('Test')} + {this.renderSavedQueries('Demo')} + +
Recent search queries
+ + {this.renderRecentQueries('cos')} + {this.renderRecentQueries('testtest')} + +
Advanced search
+
}
; } @@ -93,6 +133,31 @@ export const SearchBar = withStyles(styles)( clearTimeout(this.timeout); } + closeSearchView = () => + this.setState({ isSearchViewOpen: false }) + + + openSearchView = () => + this.setState({ isSearchViewOpen: true }) + + + renderRecentQueries = (text: string) => + + + + + renderSavedQueries = (text: string) => + + + + + + + + + + + handleSubmit = (event: React.FormEvent) => { event.preventDefault(); clearTimeout(this.timeout);