Skip to content

Commit e9d306b

Browse files
committed
feat: allow setting qeta page title and subtitle
closes #23
1 parent 25a6f8a commit e9d306b

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

docs/setup.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@ import { QetaPage } from '@drodil/backstage-plugin-qeta';
6262
const AppRoutes = () => (
6363
<FlatRoutes>
6464
// ...
65-
<Route path="/qeta" element={<QetaPage />} />
65+
<Route path="/qeta" element={<QetaPage title="Questions" />} />
6666
// ...
6767
</FlatRoutes>
6868
);
6969
```
7070
7171
An interface for Q&A is now available at `/qeta`.
72+
73+
QetaPage also takes optional properties if you want to change the page title/subtitle/elements shown in the header.

plugins/qeta/dev/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ const qetaDevPlugin = createPlugin({
3232
createDevApp()
3333
.registerPlugin(qetaDevPlugin)
3434
.addPage({
35-
element: <QetaPage />,
35+
element: (
36+
<QetaPage
37+
title="Questions and answers"
38+
subtitle="We have answers to everything!"
39+
/>
40+
),
3641
title: 'Root Page',
3742
path: '/qeta',
3843
})

plugins/qeta/src/components/HomePage/HomePage.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,17 @@ export const HomePageContent = () => {
5858
);
5959
};
6060

61-
export const HomePage = () => (
61+
type Props = {
62+
title?: string;
63+
subtitle?: string;
64+
headerElements?: JSX.Element[];
65+
};
66+
67+
export const HomePage = (props: Props) => (
6268
<Page themeId="tool">
63-
<Header title="Q&A" style={{ paddingTop: '1rem', paddingBottom: '1rem' }} />
69+
<Header title={props.title ?? 'Q&A'} subtitle={props.subtitle}>
70+
{props.headerElements}
71+
</Header>
6472
<Routes>
6573
<Route path="/" element={<HomePageContent />} />
6674
<Route path="/ask" element={<AskPage />} />

0 commit comments

Comments
 (0)