Merge pull request #11977 from omerfarukdogan/feature/docs-entity-title

feat(techdocs): use entity title in searchbar placeholder
This commit is contained in:
Eric Peterson
2022-06-13 18:12:22 +02:00
committed by GitHub
4 changed files with 13 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-techdocs': patch
---
Use entity title in `TechDocsSearch` placeholder if available.
+1
View File
@@ -380,6 +380,7 @@ export const TechDocsSearch: (props: TechDocsSearchProps) => JSX.Element;
// @public
export type TechDocsSearchProps = {
entityId: CompoundEntityRef;
entityTitle?: string;
debounceTime?: number;
};
@@ -114,7 +114,10 @@ export const TechDocsReaderPageContent = withTechDocsReaderProvider(
</Grid>
{withSearch && (
<Grid className={classes.search} xs="auto" item>
<TechDocsSearch entityId={entityRef} />
<TechDocsSearch
entityId={entityRef}
entityTitle={entityMetadata?.metadata?.title}
/>
</Grid>
)}
<Grid xs={12} item>
@@ -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={{