From 9d66d8cd906f2a23cf6739dc203bc6b6e4b2fac4 Mon Sep 17 00:00:00 2001 From: Rik Claessens Date: Fri, 12 Jul 2024 23:28:36 +0200 Subject: [PATCH] Make use of the useApp hook to retrieve search icon Signed-off-by: Rik Claessens --- .changeset/sixty-rabbits-cheat.md | 5 +++++ plugins/search-react/src/components/SearchBar/SearchBar.tsx | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/sixty-rabbits-cheat.md 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 = (