From cdf8e8aab0b2f72c7ca2c40dbb3b6d362b88b401 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=96mer=20Faruk=20Do=C4=9Fan?=
<8117265+omerfarukdogan@users.noreply.github.com>
Date: Mon, 13 Jun 2022 09:08:24 +0300
Subject: [PATCH] feat(techdocs): use entity title in searchbar placeholder
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Ömer Faruk Doğan <8117265+omerfarukdogan@users.noreply.github.com>
---
.changeset/tall-jobs-warn.md | 5 +++++
plugins/techdocs/api-report.md | 1 +
.../TechDocsReaderPageContent/TechDocsReaderPageContent.tsx | 5 ++++-
plugins/techdocs/src/search/components/TechDocsSearch.tsx | 5 +++--
4 files changed, 13 insertions(+), 3 deletions(-)
create mode 100644 .changeset/tall-jobs-warn.md
diff --git a/.changeset/tall-jobs-warn.md b/.changeset/tall-jobs-warn.md
new file mode 100644
index 0000000000..00154bc9e3
--- /dev/null
+++ b/.changeset/tall-jobs-warn.md
@@ -0,0 +1,5 @@
+---
+'@backstage/plugin-techdocs': patch
+---
+
+Use entity title in `TechDocsSearch` placeholder if available.
diff --git a/plugins/techdocs/api-report.md b/plugins/techdocs/api-report.md
index 7778c07ef4..d4ec65ed53 100644
--- a/plugins/techdocs/api-report.md
+++ b/plugins/techdocs/api-report.md
@@ -380,6 +380,7 @@ export const TechDocsSearch: (props: TechDocsSearchProps) => JSX.Element;
// @public
export type TechDocsSearchProps = {
entityId: CompoundEntityRef;
+ entityTitle?: string;
debounceTime?: number;
};
diff --git a/plugins/techdocs/src/reader/components/TechDocsReaderPageContent/TechDocsReaderPageContent.tsx b/plugins/techdocs/src/reader/components/TechDocsReaderPageContent/TechDocsReaderPageContent.tsx
index c31979b5f9..000a1ba275 100644
--- a/plugins/techdocs/src/reader/components/TechDocsReaderPageContent/TechDocsReaderPageContent.tsx
+++ b/plugins/techdocs/src/reader/components/TechDocsReaderPageContent/TechDocsReaderPageContent.tsx
@@ -114,7 +114,10 @@ export const TechDocsReaderPageContent = withTechDocsReaderProvider(
{withSearch && (
-
+
)}
diff --git a/plugins/techdocs/src/search/components/TechDocsSearch.tsx b/plugins/techdocs/src/search/components/TechDocsSearch.tsx
index 509c991353..647520af8c 100644
--- a/plugins/techdocs/src/search/components/TechDocsSearch.tsx
+++ b/plugins/techdocs/src/search/components/TechDocsSearch.tsx
@@ -46,6 +46,7 @@ const useStyles = makeStyles({
*/
export type TechDocsSearchProps = {
entityId: CompoundEntityRef;
+ entityTitle?: string;
debounceTime?: number;
};
@@ -64,7 +65,7 @@ type TechDocsSearchResult = {
};
const TechDocsSearchBar = (props: TechDocsSearchProps) => {
- const { entityId, debounceTime = 150 } = props;
+ const { entityId, entityTitle, debounceTime = 150 } = props;
const [open, setOpen] = useState(false);
const navigate = useNavigate();
const {
@@ -160,7 +161,7 @@ const TechDocsSearchBar = (props: TechDocsSearchProps) => {
data-testid="techdocs-search-bar-input"
variant="outlined"
fullWidth
- placeholder={`Search ${entityId.name} docs`}
+ placeholder={`Search ${entityTitle || entityId.name} docs`}
value={value}
onChange={handleQuery}
InputProps={{