diff --git a/.changeset/sixty-rabbits-cheat.md b/.changeset/sixty-rabbits-cheat.md new file mode 100644 index 0000000000..a713574c1e --- /dev/null +++ b/.changeset/sixty-rabbits-cheat.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-search-react': minor +--- + +Make use of the useApp hook to retrieve the specified search icon in the SearchBar diff --git a/plugins/search-react/src/components/SearchBar/SearchBar.tsx b/plugins/search-react/src/components/SearchBar/SearchBar.tsx index 254f39e48e..c6976508cc 100644 --- a/plugins/search-react/src/components/SearchBar/SearchBar.tsx +++ b/plugins/search-react/src/components/SearchBar/SearchBar.tsx @@ -18,13 +18,14 @@ import { AnalyticsContext, configApiRef, useApi, + useApp, } from '@backstage/core-plugin-api'; import IconButton from '@material-ui/core/IconButton'; import InputAdornment from '@material-ui/core/InputAdornment'; import TextField from '@material-ui/core/TextField'; import Button from '@material-ui/core/Button'; import { TextFieldProps } from '@material-ui/core/TextField'; -import SearchIcon from '@material-ui/icons/Search'; +import DefaultSearchIcon from '@material-ui/icons/Search'; import React, { ChangeEvent, ComponentType, @@ -146,6 +147,8 @@ export const SearchBarBase: ForwardRefExoticComponent = placeholder ?? `Search in ${configApi.getOptionalString('app.title') || 'Backstage'}`; + const SearchIcon = useApp().getSystemIcon('search') || DefaultSearchIcon; + const startAdornment = (