diff --git a/.changeset/techdocs-tal-jobs-warn.md b/.changeset/techdocs-tal-jobs-warn.md new file mode 100644 index 0000000000..00154bc9e3 --- /dev/null +++ b/.changeset/techdocs-tal-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={{