X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/79e636fa713d11b4b7188985e78c8ff1c094d9a0..f6daa8a9318d5d7bec1cb173d8897cfcb9826157:/src/views-components/search-bar/search-bar-view.tsx diff --git a/src/views-components/search-bar/search-bar-view.tsx b/src/views-components/search-bar/search-bar-view.tsx index 09b75bbf..6251308d 100644 --- a/src/views-components/search-bar/search-bar-view.tsx +++ b/src/views-components/search-bar/search-bar-view.tsx @@ -11,7 +11,6 @@ import { WithStyles, Tooltip, InputAdornment, Input, - Popover, } from '@material-ui/core'; import SearchIcon from '@material-ui/icons/Search'; import ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown'; @@ -41,12 +40,14 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => { container: { position: 'relative', width: '100%', - borderRadius: theme.spacing.unit / 2 + borderRadius: theme.spacing.unit / 2, + zIndex: theme.zIndex.modal, }, containerSearchViewOpened: { position: 'relative', width: '100%', - borderRadius: `${theme.spacing.unit / 2}px ${theme.spacing.unit / 2}px 0 0` + borderRadius: `${theme.spacing.unit / 2}px ${theme.spacing.unit / 2}px 0 0`, + zIndex: theme.zIndex.modal, }, input: { border: 'none', @@ -144,98 +145,53 @@ const handleDropdownClick = (e: React.MouseEvent, props: SearchBarViewProps) => }; export const SearchBarView = withStyles(styles)( - class SearchBarView extends React.Component { - - viewAnchorRef = React.createRef(); - - render() { - const { children, ...props } = this.props; - const { classes, isPopoverOpen } = props; - return ( - -
-
- - + (props: SearchBarViewProps) => { + const { classes, isPopoverOpen } = props; + return ( + <> + + {isPopoverOpen && + } + + +
+ handleInputClick(e, props)} + onKeyDown={e => handleKeyDown(e, props)} + startAdornment={ + + + + + + + + } + endAdornment={ + + + handleDropdownClick(e, props)}> + + + + + } /> +
+
+ {isPopoverOpen && getView({ ...props })}
- - { - getView({ ...props }) - } -
- ); - } - - getViewWidth() { - const { current } = this.viewAnchorRef; - return current ? current.offsetWidth : 0; - } + + ); } - ); -const SearchInput = (props: SearchBarViewProps) => { - const { classes } = props; - return handleInputClick(e, props)} - onKeyDown={e => handleKeyDown(e, props)} - startAdornment={ - - - - - - - - } - endAdornment={ - - - handleDropdownClick(e, props)}> - - - - - } />; -}; - -const SearchViewContainer = (props: SearchBarViewProps & { width: number, anchorEl: HTMLElement | null, children: React.ReactNode }) => - - { - props.children - } - ; - - const getView = (props: SearchBarViewProps) => { switch (props.currentView) { case SearchView.AUTOCOMPLETE: @@ -260,3 +216,16 @@ const getView = (props: SearchBarViewProps) => { selectedItem={props.selectedItem} />; } }; + +const Backdrop = withStyles<'backdrop'>(theme => ({ + backdrop: { + position: 'fixed', + top: 0, + right: 0, + bottom: 0, + left: 0, + zIndex: theme.zIndex.modal + } +}))( + ({ classes, ...props }: WithStyles<'backdrop'> & React.HTMLProps) => +
);