fix techdocs-cli embedded app

Co-authored-by: Camila Belo <camilaibs@gmail.com>
Co-authored-by: Eric Peterson <ericpeterson@spotify.com>
Signed-off-by: Emma Indal <emma.indahl@gmail.com>
This commit is contained in:
Emma Indal
2022-04-01 14:40:00 +02:00
parent 914cfdb0b7
commit c969da2fcd
3 changed files with 15 additions and 12 deletions
@@ -66,4 +66,4 @@
"last 1 safari version"
]
}
}
}
@@ -64,7 +64,7 @@ type TechDocsThemeValue = {
const TechDocsThemeContext = createContext<TechDocsThemeValue>({
theme: Themes.LIGHT,
toggleTheme: () => {},
toggleTheme: () => { },
});
const TechdocsThemeProvider: FC = ({ children }) => {
@@ -120,11 +120,13 @@ export const TechDocsThemeToggle = () => {
);
};
export const techDocsPage = (
<TechDocsReaderPage>
<TechdocsThemeProvider>
const DefaultTechDocsPage = () => {
return <TechdocsThemeProvider>
<TechDocsReaderPage>
<TechDocsReaderPageHeader />
<TechDocsReaderPageContent withSearch={false} />
</TechdocsThemeProvider>
</TechDocsReaderPage>
);
</TechDocsReaderPage>
</TechdocsThemeProvider>
}
export const techDocsPage = <DefaultTechDocsPage />
@@ -83,16 +83,17 @@ export type TechDocsReaderPageProps = {
*/
export const TechDocsReaderPage = ({
entityRef,
children,
children
}: TechDocsReaderPageProps) => {
const { kind, name, namespace } = useParams();
const route = useOutlet() || { props: { children: [] } };
const outlet = useOutlet()
const entityName = entityRef ?? { kind, name, namespace };
if (!children) {
const outlet = Children.toArray(route.props.children);
const childrenList = outlet ? Children.toArray(outlet.props.children) : [];
const page = outlet.find(child => {
const page = childrenList.find(child => {
const { type } = child as Extension;
return !type?.__backstage_data?.map?.get(TECHDOCS_ADDONS_WRAPPER_KEY);
});