fix: pass down withSearch from EntityTechdocsContent component
Signed-off-by: Yasser Hennawi <yahennawi@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-techdocs': patch
|
||||
---
|
||||
|
||||
Allow passing down `withSearch` prop to `EntityTechdocsContent` component since it was `true` by default, now user can use the `EntityTechdocsContent` component _without_ showing the search field on top of the content.
|
||||
@@ -133,9 +133,12 @@ export type DocsTableRow = {
|
||||
};
|
||||
|
||||
// @public
|
||||
export const EmbeddedDocsRouter: (
|
||||
props: PropsWithChildren<{}>,
|
||||
) => React_2.JSX.Element;
|
||||
export const EmbeddedDocsRouter: ({
|
||||
children,
|
||||
withSearch,
|
||||
}: React_2.PropsWithChildren<{
|
||||
withSearch?: boolean | undefined;
|
||||
}>) => React_2.JSX.Element;
|
||||
|
||||
// @public
|
||||
export const EntityListDocsGrid: (
|
||||
@@ -191,9 +194,12 @@ export type EntityListDocsTableProps = {
|
||||
};
|
||||
|
||||
// @public
|
||||
export const EntityTechdocsContent: (props: {
|
||||
children?: ReactNode;
|
||||
}) => JSX_2.Element;
|
||||
export const EntityTechdocsContent: ({
|
||||
children,
|
||||
withSearch,
|
||||
}: PropsWithChildren<{
|
||||
withSearch?: boolean | undefined;
|
||||
}>) => JSX_2.Element;
|
||||
|
||||
// @public
|
||||
export const isTechDocsAvailable: (entity: Entity) => boolean;
|
||||
|
||||
@@ -57,16 +57,19 @@ export const Router = () => {
|
||||
};
|
||||
|
||||
export const EmbeddedDocsRouter = (
|
||||
props: PropsWithChildren<{ emptyState?: React.ReactElement }>,
|
||||
props: PropsWithChildren<{
|
||||
emptyState?: React.ReactElement;
|
||||
withSearch?: boolean;
|
||||
}>,
|
||||
) => {
|
||||
const { children, emptyState } = props;
|
||||
const { children, emptyState, withSearch = true } = props;
|
||||
const { entity } = useEntity();
|
||||
|
||||
// Using objects instead of <Route> elements, otherwise "outlet" will be null on sub-pages and add-ons won't render
|
||||
const element = useRoutes([
|
||||
{
|
||||
path: '/*',
|
||||
element: <EntityPageDocs entity={entity} />,
|
||||
element: <EntityPageDocs entity={entity} withSearch={withSearch} />,
|
||||
children: [
|
||||
{
|
||||
path: '*',
|
||||
@@ -96,8 +99,11 @@ export const EmbeddedDocsRouter = (
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const LegacyEmbeddedDocsRouter = (props: PropsWithChildren<{}>) => {
|
||||
export const LegacyEmbeddedDocsRouter = ({
|
||||
children,
|
||||
withSearch = true,
|
||||
}: PropsWithChildren<{ withSearch?: boolean }>) => {
|
||||
// Wrap the Router to avoid exposing the emptyState prop in the non-alpha
|
||||
// public API and make it easier for us to change later.
|
||||
return <EmbeddedDocsRouter children={props.children} />;
|
||||
return <EmbeddedDocsRouter children={children} withSearch={withSearch} />;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user