techdocs: hide Router emptyState prop in non-alpha public api

Signed-off-by: MT Lewis <mtlewis@users.noreply.github.com>
This commit is contained in:
MT Lewis
2024-09-16 12:08:06 +01:00
parent 0e9dbf8d64
commit 7120d77a33
4 changed files with 22 additions and 20 deletions
+5 -13
View File
@@ -16,10 +16,8 @@ import { EntityOwnerPickerProps } from '@backstage/plugin-catalog-react';
import { FetchApi } from '@backstage/core-plugin-api';
import { IdentityApi } from '@backstage/core-plugin-api';
import { JSX as JSX_2 } from 'react';
import { JSXElementConstructor } from 'react';
import { PropsWithChildren } from 'react';
import { default as React_2 } from 'react';
import { ReactElement } from 'react';
import { ReactNode } from 'react';
import { ResultHighlight } from '@backstage/plugin-search-common';
import { RouteRef } from '@backstage/core-plugin-api';
@@ -135,10 +133,8 @@ export type DocsTableRow = {
// @public
export const EmbeddedDocsRouter: (
props: PropsWithChildren<{
emptyState?: React_2.ReactElement;
}>,
) => React_2.JSX.Element | null;
props: PropsWithChildren<{}>,
) => React_2.JSX.Element;
// @public
export const EntityListDocsGrid: (
@@ -194,13 +190,9 @@ export type EntityListDocsTableProps = {
};
// @public
export const EntityTechdocsContent: (
props: PropsWithChildren<{
emptyState?:
| ReactElement<any, string | JSXElementConstructor<any>>
| undefined;
}>,
) => JSX_2.Element | null;
export const EntityTechdocsContent: (props: {
children?: ReactNode;
}) => JSX_2.Element;
// @public
export const isTechDocsAvailable: (entity: Entity) => boolean;
+11 -5
View File
@@ -56,11 +56,6 @@ export const Router = () => {
);
};
/**
* Responsible for registering route to view docs on Entity page
*
* @public
*/
export const EmbeddedDocsRouter = (
props: PropsWithChildren<{ emptyState?: React.ReactElement }>,
) => {
@@ -95,3 +90,14 @@ export const EmbeddedDocsRouter = (
return element;
};
/**
* Responsible for registering route to view docs on Entity page
*
* @public
*/
export const LegacyEmbeddedDocsRouter = (props: PropsWithChildren<{}>) => {
// 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} />;
};
+5 -1
View File
@@ -41,7 +41,11 @@ export {
techdocsPlugin as plugin,
techdocsPlugin,
} from './plugin';
export * from './Router';
export {
isTechDocsAvailable,
LegacyEmbeddedDocsRouter as EmbeddedDocsRouter,
Router,
} from './Router';
export type { TechDocsSearchResultListItemProps } from './search/components/TechDocsSearchResultListItem';
+1 -1
View File
@@ -103,7 +103,7 @@ export const TechdocsPage = techdocsPlugin.provide(
export const EntityTechdocsContent = techdocsPlugin.provide(
createRoutableExtension({
name: 'EntityTechdocsContent',
component: () => import('./Router').then(m => m.EmbeddedDocsRouter),
component: () => import('./Router').then(m => m.LegacyEmbeddedDocsRouter),
mountPoint: rootCatalogDocsRouteRef,
}),
);