feat: allow specifying custom title for DevToolsLayout

Signed-off-by: Heikki Hellgren <heikki.hellgren@op.fi>
This commit is contained in:
Heikki Hellgren
2023-06-15 14:20:40 +03:00
committed by blam
parent 9a16cce2fd
commit 5969639fd0
3 changed files with 16 additions and 3 deletions
@@ -40,6 +40,8 @@ attachComponentData(Route, 'core.gatherMountPoints', true);
/** @public */
export type DevToolsLayoutProps = {
title?: string;
subtitle?: string;
children?: React.ReactNode;
};
@@ -56,7 +58,11 @@ export type DevToolsLayoutProps = {
* ```
* @public
*/
export const DevToolsLayout = ({ children }: DevToolsLayoutProps) => {
export const DevToolsLayout = ({
children,
title,
subtitle,
}: DevToolsLayoutProps) => {
const routes = useElementFilter(children, elements =>
elements
.selectByComponentData({
@@ -70,7 +76,7 @@ export const DevToolsLayout = ({ children }: DevToolsLayoutProps) => {
return (
<Page themeId="home">
<Header title="Backstage DevTools" />
<Header title={title ?? 'Backstage DevTools'} subtitle={subtitle} />
<RoutedTabs routes={routes} />
</Page>
);