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:
Ömer Faruk Doğan
2022-06-13 09:08:24 +03:00
parent 95d63f873e
commit cdf8e8aab0
4 changed files with 13 additions and 3 deletions
+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={{