diff --git a/.changeset/gentle-deers-return.md b/.changeset/gentle-deers-return.md new file mode 100644 index 0000000000..5784226b1d --- /dev/null +++ b/.changeset/gentle-deers-return.md @@ -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. diff --git a/plugins/techdocs/report.api.md b/plugins/techdocs/report.api.md index c577de5eac..196fef5f35 100644 --- a/plugins/techdocs/report.api.md +++ b/plugins/techdocs/report.api.md @@ -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; diff --git a/plugins/techdocs/src/Router.tsx b/plugins/techdocs/src/Router.tsx index 352c9f5b73..6a0bc0e08e 100644 --- a/plugins/techdocs/src/Router.tsx +++ b/plugins/techdocs/src/Router.tsx @@ -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 elements, otherwise "outlet" will be null on sub-pages and add-ons won't render const element = useRoutes([ { path: '/*', - element: , + element: , 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 ; + return ; };