diff --git a/.changeset/bright-pumpkins-rule.md b/.changeset/bright-pumpkins-rule.md new file mode 100644 index 0000000000..07de4f313c --- /dev/null +++ b/.changeset/bright-pumpkins-rule.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-notifications': patch +--- + +Allow overriding `NotificationsPage` page properties diff --git a/plugins/notifications/api-report.md b/plugins/notifications/api-report.md index dc0db705ba..f1369a882d 100644 --- a/plugins/notifications/api-report.md +++ b/plugins/notifications/api-report.md @@ -74,7 +74,19 @@ export class NotificationsClient implements NotificationsApi { } // @public (undocumented) -export const NotificationsPage: () => JSX_2.Element; +export const NotificationsPage: ( + props?: NotificationsPageProps | undefined, +) => JSX_2.Element; + +// @public (undocumented) +export type NotificationsPageProps = { + title?: string; + themeId?: string; + subtitle?: string; + tooltip?: string; + type?: string; + typeLink?: string; +}; // @public (undocumented) export const notificationsPlugin: BackstagePlugin< diff --git a/plugins/notifications/dev/index.tsx b/plugins/notifications/dev/index.tsx index f4d9176a70..b601c4b9a4 100644 --- a/plugins/notifications/dev/index.tsx +++ b/plugins/notifications/dev/index.tsx @@ -15,13 +15,21 @@ */ import React from 'react'; import { createDevApp } from '@backstage/dev-utils'; -import { NotificationsPage, notificationsPlugin } from '../src/plugin'; -import { NotificationsSidebarItem } from '../src'; +import { + NotificationsPage, + notificationsPlugin, + NotificationsSidebarItem, +} from '../src'; createDevApp() .registerPlugin(notificationsPlugin) .addPage({ - element: , + element: ( + + ), path: '/notifications', }) .addSidebarItem() diff --git a/plugins/notifications/src/components/NotificationsPage/NotificationsPage.tsx b/plugins/notifications/src/components/NotificationsPage/NotificationsPage.tsx index 3069619eef..539db4f61e 100644 --- a/plugins/notifications/src/components/NotificationsPage/NotificationsPage.tsx +++ b/plugins/notifications/src/components/NotificationsPage/NotificationsPage.tsx @@ -37,7 +37,26 @@ import { NotificationSeverity } from '@backstage/plugin-notifications-common'; const ThrottleDelayMs = 2000; -export const NotificationsPage = () => { +/** @public */ +export type NotificationsPageProps = { + title?: string; + themeId?: string; + subtitle?: string; + tooltip?: string; + type?: string; + typeLink?: string; +}; + +export const NotificationsPage = (props?: NotificationsPageProps) => { + const { + title = 'Notifications', + themeId = 'tool', + subtitle, + tooltip, + type, + typeLink, + } = props ?? {}; + const [refresh, setRefresh] = React.useState(false); const { lastSignal } = useSignal('notifications'); const [unreadOnly, setUnreadOnly] = React.useState(true); @@ -113,7 +132,14 @@ export const NotificationsPage = () => { } return ( - + diff --git a/plugins/notifications/src/components/index.ts b/plugins/notifications/src/components/index.ts index 3bca70a215..022ae07198 100644 --- a/plugins/notifications/src/components/index.ts +++ b/plugins/notifications/src/components/index.ts @@ -15,3 +15,4 @@ */ export * from './NotificationsSideBarItem'; export * from './NotificationsTable'; +export type { NotificationsPageProps } from './NotificationsPage';