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
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-devtools': patch
---
Allow specifying custom title for `DevToolsLayout`
+3 -1
View File
@@ -15,12 +15,14 @@ export const ConfigContent: () => JSX.Element;
// @public
export const DevToolsLayout: {
({ children }: DevToolsLayoutProps): JSX.Element;
({ children, title, subtitle }: DevToolsLayoutProps): JSX.Element;
Route: (props: SubRoute) => null;
};
// @public (undocumented)
export type DevToolsLayoutProps = {
title?: string;
subtitle?: string;
children?: default_2.ReactNode;
};
@@ -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>
);