@@ -95,11 +95,9 @@ export const Root = ({ children }: PropsWithChildren<{}>) => (
|
||||
{/* Global nav, not org-specific */}
|
||||
<SidebarItem icon={HomeIcon} to="catalog" text="Home" />
|
||||
<MyGroupsSidebarItem
|
||||
props={{
|
||||
singularTitle: 'My Squad',
|
||||
pluralTitle: 'My Squads',
|
||||
icon: GroupIcon,
|
||||
}}
|
||||
singularTitle="My Squad"
|
||||
pluralTitle="My Squads"
|
||||
icon={GroupIcon}
|
||||
/>
|
||||
<SidebarItem icon={ExtensionIcon} to="api-docs" text="APIs" />
|
||||
<SidebarItem icon={LibraryBooks} to="docs" text="Docs" />
|
||||
|
||||
@@ -35,10 +35,10 @@ To use the MyGroupsSidebarItem you'll need to add it to your `Root.tsx` - found
|
||||
{/* Global nav, not org-specific */}
|
||||
//...
|
||||
<SidebarItem icon={HomeIcon} to="catalog" text="Home" />
|
||||
+ <MyGroupsSidebarItem props={{
|
||||
+ singularTitle: "My Squad",
|
||||
+ pluralTitle: "My Squads",
|
||||
+ icon: GroupIcon}}
|
||||
+ <MyGroupsSidebarItem
|
||||
+ singularTitle='My Squad'
|
||||
+ pluralTitle='My Squads'
|
||||
+ icon={GroupIcon}
|
||||
+ />
|
||||
//...
|
||||
</SidebarGroup>
|
||||
@@ -53,6 +53,6 @@ Once added MyGroupsSidebarItem will work in three ways:
|
||||
|
||||

|
||||
|
||||
3. The user is logged in and a member of more than one group: the MyGroupsSidebarItem will display a single items with a submenu with all the related groups like this:
|
||||
3. The user is logged in and a member of more than one group: the MyGroupsSidebarItem will display a single items with a sub-menu with all the related groups like this:
|
||||
|
||||

|
||||
|
||||
@@ -66,14 +66,14 @@ export const MembersListCard: (_props: {
|
||||
|
||||
// @public
|
||||
export const MyGroupsSidebarItem: ({
|
||||
props,
|
||||
singularTitle,
|
||||
pluralTitle,
|
||||
icon,
|
||||
}: {
|
||||
props: {
|
||||
singularTitle: string;
|
||||
pluralTitle: string;
|
||||
icon: IconComponent;
|
||||
};
|
||||
}) => JSX.Element;
|
||||
singularTitle: string;
|
||||
pluralTitle: string;
|
||||
icon: IconComponent;
|
||||
}) => JSX.Element | null;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "orgPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
|
||||
@@ -47,11 +47,9 @@ describe('MyGroupsSidebarItem Test', () => {
|
||||
]}
|
||||
>
|
||||
<MyGroupsSidebarItem
|
||||
props={{
|
||||
singularTitle: 'My Squad',
|
||||
pluralTitle: 'My Squads',
|
||||
icon: GroupIcon,
|
||||
}}
|
||||
singularTitle="My Squad"
|
||||
pluralTitle="My Squads"
|
||||
icon={GroupIcon}
|
||||
/>
|
||||
</TestApiProvider>,
|
||||
{
|
||||
@@ -103,11 +101,9 @@ describe('MyGroupsSidebarItem Test', () => {
|
||||
]}
|
||||
>
|
||||
<MyGroupsSidebarItem
|
||||
props={{
|
||||
singularTitle: 'My Squad',
|
||||
pluralTitle: 'My Squads',
|
||||
icon: GroupIcon,
|
||||
}}
|
||||
singularTitle="My Squad"
|
||||
pluralTitle="My Squads"
|
||||
icon={GroupIcon}
|
||||
/>
|
||||
</TestApiProvider>,
|
||||
{
|
||||
@@ -187,11 +183,9 @@ describe('MyGroupsSidebarItem Test', () => {
|
||||
]}
|
||||
>
|
||||
<MyGroupsSidebarItem
|
||||
props={{
|
||||
singularTitle: 'My Squad',
|
||||
pluralTitle: 'My Squads',
|
||||
icon: GroupIcon,
|
||||
}}
|
||||
singularTitle="My Squad"
|
||||
pluralTitle="My Squads"
|
||||
icon={GroupIcon}
|
||||
/>
|
||||
</TestApiProvider>,
|
||||
{
|
||||
|
||||
@@ -40,11 +40,15 @@ import { getCompoundEntityRef } from '@backstage/catalog-model';
|
||||
* @public
|
||||
*/
|
||||
export const MyGroupsSidebarItem = ({
|
||||
props,
|
||||
singularTitle,
|
||||
pluralTitle,
|
||||
icon,
|
||||
}: {
|
||||
props: { singularTitle: string; pluralTitle: string; icon: IconComponent };
|
||||
singularTitle: string;
|
||||
pluralTitle: string;
|
||||
icon: IconComponent;
|
||||
}) => {
|
||||
const { singularTitle, pluralTitle, icon } = props;
|
||||
// const { singularTitle, pluralTitle, icon } = props;
|
||||
const identityApi = useApi(identityApiRef);
|
||||
const catalogApi: CatalogApi = useApi(catalogApiRef);
|
||||
const catalogEntityRoute = useRouteRef(entityRouteRef);
|
||||
|
||||
Reference in New Issue
Block a user