feat(techdocs): use entity title in searchbar placeholder
Signed-off-by: Ömer Faruk Doğan <8117265+omerfarukdogan@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-techdocs': patch
|
||||
---
|
||||
|
||||
Use entity title in `TechDocsSearch` placeholder if available.
|
||||
@@ -380,6 +380,7 @@ export const TechDocsSearch: (props: TechDocsSearchProps) => JSX.Element;
|
||||
// @public
|
||||
export type TechDocsSearchProps = {
|
||||
entityId: CompoundEntityRef;
|
||||
entityTitle?: string;
|
||||
debounceTime?: number;
|
||||
};
|
||||
|
||||
|
||||
+4
-1
@@ -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={{
|
||||
|
||||
Reference in New Issue
Block a user