Skip to content

Commit f39d97f

Browse files
authored
feat(announcements): add banner for nfs (#6086)
this adds the missing banner for the new frontend system to show announcements globally. Signed-off-by: Hellgren Heikki <[email protected]>
1 parent 5724534 commit f39d97f

File tree

5 files changed

+88
-0
lines changed

5 files changed

+88
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@backstage-community/plugin-announcements': patch
3+
---
4+
5+
Added announcement banner as app root element for the new frontend system.

workspaces/announcements/plugins/announcements/report-alpha.api.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { EntityPredicate } from '@backstage/plugin-catalog-react/alpha';
1414
import { ExtensionBlueprintParams } from '@backstage/frontend-plugin-api';
1515
import { ExtensionDataRef } from '@backstage/frontend-plugin-api';
1616
import { ExtensionDefinition } from '@backstage/frontend-plugin-api';
17+
import { ExtensionInput } from '@backstage/frontend-plugin-api';
1718
import { IconComponent } from '@backstage/core-plugin-api';
1819
import { JSX as JSX_2 } from 'react';
1920
import { OverridableFrontendPlugin } from '@backstage/frontend-plugin-api';
@@ -47,6 +48,45 @@ const _default: OverridableFrontendPlugin<
4748
params: ApiFactory<TApi, TImpl, TDeps>,
4849
) => ExtensionBlueprintParams<AnyApiFactory>;
4950
}>;
51+
'app-root-element:announcements/banner': ExtensionDefinition<{
52+
config: {
53+
variant: 'block' | 'floating';
54+
max: number | undefined;
55+
category: string | undefined;
56+
active: boolean | undefined;
57+
current: boolean | undefined;
58+
tags: string[] | undefined;
59+
};
60+
configInput: {
61+
variant?: 'block' | 'floating' | undefined;
62+
max?: number | undefined;
63+
active?: boolean | undefined;
64+
current?: boolean | undefined;
65+
tags?: string[] | undefined;
66+
category?: string | undefined;
67+
};
68+
output: ExtensionDataRef<JSX_2.Element, 'core.reactElement', {}>;
69+
inputs: {
70+
[x: string]: ExtensionInput<
71+
ExtensionDataRef<
72+
unknown,
73+
string,
74+
{
75+
optional?: true | undefined;
76+
}
77+
>,
78+
{
79+
optional: boolean;
80+
singleton: boolean;
81+
}
82+
>;
83+
};
84+
kind: 'app-root-element';
85+
name: 'banner';
86+
params: {
87+
element: JSX.Element;
88+
};
89+
}>;
5090
'entity-card:announcements/announcements': ExtensionDefinition<{
5191
kind: 'entity-card';
5292
name: 'announcements';

workspaces/announcements/plugins/announcements/src/alpha.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
announcementsSearchResultListItem,
2525
} from './alpha/search';
2626
import { rootRouteRef } from './routes';
27+
import { announcementsBanner } from './alpha/banner';
2728

2829
/**
2930
* @alpha
@@ -40,5 +41,6 @@ export default createFrontendPlugin({
4041
announcementsNavItem,
4142
announcementsSearchResultListItem,
4243
announcementsSearchFilterResultType,
44+
announcementsBanner,
4345
],
4446
});
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright 2025 The Backstage Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import { AppRootElementBlueprint } from '@backstage/frontend-plugin-api';
18+
import { NewAnnouncementBanner } from '../components/NewAnnouncementBanner';
19+
20+
/**
21+
* @alpha
22+
*/
23+
export const announcementsBanner = AppRootElementBlueprint.makeWithOverrides({
24+
name: 'banner',
25+
config: {
26+
schema: {
27+
variant: z => z.enum(['block', 'floating']).default('floating'),
28+
max: z => z.number().optional(),
29+
category: z => z.string().optional(),
30+
active: z => z.boolean().optional(),
31+
current: z => z.boolean().optional(),
32+
tags: z => z.array(z.string()).optional(),
33+
},
34+
},
35+
factory: (originalFactory, { config }) => {
36+
return originalFactory({
37+
element: <NewAnnouncementBanner {...config} />,
38+
});
39+
},
40+
});

workspaces/announcements/plugins/announcements/src/alpha/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ export * from './entityCards';
1818
export * from './navItems';
1919
export * from './pages';
2020
export * from './search';
21+
export * from './banner';

0 commit comments

Comments
 (0)