diff --git a/packages/app/src/components/search/SearchModal.tsx b/packages/app/src/components/search/SearchModal.tsx index 16988d0ae9..e2d46b2e19 100644 --- a/packages/app/src/components/search/SearchModal.tsx +++ b/packages/app/src/components/search/SearchModal.tsx @@ -37,20 +37,24 @@ import { DialogTitle, Grid, makeStyles, - Paper, } from '@material-ui/core'; +import Button from '@material-ui/core/Button'; import IconButton from '@material-ui/core/IconButton'; -import Typography from '@material-ui/core/Typography'; +import ArrowForwardIcon from '@material-ui/icons/ArrowForward'; import BuildIcon from '@material-ui/icons/Build'; import CloseIcon from '@material-ui/icons/Close'; -import LaunchIcon from '@material-ui/icons/Launch'; import React, { KeyboardEvent, useCallback, useEffect, useRef } from 'react'; import { useNavigate } from 'react-router-dom'; const useStyles = makeStyles(theme => ({ dialogTitle: { + gap: theme.spacing(1), display: 'grid', + alignItems: 'center', gridTemplateColumns: '1fr auto', + '&> button': { + marginTop: theme.spacing(1), + }, }, container: { borderRadius: 30, @@ -90,7 +94,7 @@ export const SearchModal = ({ toggleModal }: { toggleModal: () => void }) => { }); const handleSearchBarKeyDown = useCallback( - (e: KeyboardEvent) => { + (e: KeyboardEvent) => { if (e.key === 'Enter') { toggleModal(); navigate(searchPagePath); @@ -103,15 +107,13 @@ export const SearchModal = ({ toggleModal }: { toggleModal: () => void }) => { <> - - - + - toggleModal()}> + @@ -186,15 +188,15 @@ export const SearchModal = ({ toggleModal }: { toggleModal: () => void }) => { alignItems="center" > - - - View Full Results - - - + diff --git a/packages/app/src/components/search/SearchPage.tsx b/packages/app/src/components/search/SearchPage.tsx index 6e1599bacc..1aa15446c2 100644 --- a/packages/app/src/components/search/SearchPage.tsx +++ b/packages/app/src/components/search/SearchPage.tsx @@ -70,9 +70,7 @@ const SearchPage = () => { - - - + {!isMobile && ( diff --git a/plugins/search-react/src/components/SearchBar/SearchBar.tsx b/plugins/search-react/src/components/SearchBar/SearchBar.tsx index 9c312718bf..1be8043b65 100644 --- a/plugins/search-react/src/components/SearchBar/SearchBar.tsx +++ b/plugins/search-react/src/components/SearchBar/SearchBar.tsx @@ -13,39 +13,32 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -import React, { - ChangeEvent, - KeyboardEvent, - useState, - useEffect, - useCallback, - forwardRef, - ComponentType, - ForwardRefExoticComponent, -} from 'react'; -import useDebounce from 'react-use/lib/useDebounce'; - -import { - InputBase, - InputBaseProps, - InputAdornment, - IconButton, -} from '@material-ui/core'; -import SearchIcon from '@material-ui/icons/Search'; -import ClearButton from '@material-ui/icons/Clear'; - import { AnalyticsContext, configApiRef, useApi, } from '@backstage/core-plugin-api'; +import { IconButton, InputAdornment, TextField } from '@material-ui/core'; +import { TextFieldProps } from '@material-ui/core/TextField'; +import ClearButton from '@material-ui/icons/Clear'; +import SearchIcon from '@material-ui/icons/Search'; +import React, { + ChangeEvent, + ComponentType, + forwardRef, + ForwardRefExoticComponent, + KeyboardEvent, + useCallback, + useEffect, + useState, +} from 'react'; +import useDebounce from 'react-use/lib/useDebounce'; import { SearchContextProvider, useSearch } from '../../context'; import { TrackSearch } from '../SearchTracker'; function withContext(Component: ComponentType) { - return forwardRef((props, ref) => ( + return forwardRef((props, ref) => ( @@ -57,12 +50,13 @@ function withContext(Component: ComponentType) { * * @public */ -export type SearchBarBaseProps = Omit & { +export type SearchBarBaseProps = Omit & { debounceTime?: number; clearButton?: boolean; onClear?: () => void; onSubmit?: () => void; onChange: (value: string) => void; + endAdornment?: React.ReactNode; }; /** @@ -109,7 +103,7 @@ export const SearchBarBase: ForwardRefExoticComponent = ); const handleKeyDown = useCallback( - (e: KeyboardEvent) => { + (e: KeyboardEvent) => { if (onKeyDown) onKeyDown(e); if (onSubmit && e.key === 'Enter') { onSubmit(); @@ -147,14 +141,21 @@ export const SearchBarBase: ForwardRefExoticComponent = return ( - ({ + dialogTitle: { + gap: theme.spacing(1), + display: 'grid', + alignItems: 'center', + gridTemplateColumns: '1fr auto', + '&> button': { + marginTop: theme.spacing(1), + }, + }, container: { borderRadius: 30, display: 'flex', @@ -111,7 +122,7 @@ export const Modal = () => { }, [focusContent, transitions]); const handleSearchBarKeyDown = useCallback( - (e: KeyboardEvent) => { + (e: KeyboardEvent) => { if (e.key === 'Enter') { navigate(searchPagePath); handleSearchResultClick(); @@ -123,13 +134,17 @@ export const Modal = () => { return ( <> - + - + + + + + { alignItems="center" > - - - View Full Results - - - +