Add org name to page title

Signed-off-by: Adam Harvey <adam.harvey@dxc.com>
This commit is contained in:
Adam Harvey
2021-02-25 23:28:42 -05:00
parent 647bbb14f3
commit 2386de1d3c
2 changed files with 22 additions and 12 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-api-docs': patch
---
Add organization name to the API Explorer page title
@@ -14,20 +14,25 @@
* limitations under the License.
*/
import { Header, Page } from '@backstage/core';
import { Header, Page, useApi, configApiRef } from '@backstage/core';
import React from 'react';
type Props = {
children?: React.ReactNode;
};
export const ApiExplorerLayout = ({ children }: Props) => (
<Page themeId="home">
<Header
title="APIs"
subtitle="Backstage API Explorer"
pageTitleOverride="APIs"
/>
{children}
</Page>
);
export const ApiExplorerLayout = ({ children }: Props) => {
const configApi = useApi(configApiRef);
const generatedSubtitle = `${
configApi.getString('organization.name') ?? 'Backstage'
} API Explorer`;
return (
<Page themeId="home">
<Header
title="APIs"
subtitle={generatedSubtitle}
pageTitleOverride="APIs"
/>
{children}
</Page>
);
};