Skip to content

Commit

Permalink
prettier fix
Browse files Browse the repository at this point in the history
Signed-off-by: Yi Cai <[email protected]>
  • Loading branch information
ciiay committed Jan 23, 2025
1 parent 235d644 commit 1db34b3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
3 changes: 2 additions & 1 deletion docs/dynamic-plugins/frontend-plugin-wiring.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ Here are the default catalog entity routes in the default order:
The visibility of a tab is derived from the kind of entity that is being displayed along with the visibility guidance mentioned in "[Using mount points](#using-mount-points)".

## Adding global header

The frontend system also allows users to configure a custom global header and its components.

```yaml
Expand All @@ -438,7 +439,7 @@ dynamicPlugins:
importName: GlobalHeader
config:
layout:
position: above-main-content # use `above-sidebar` value to position the global header to above the sidebar
position: above-main-content # use `above-sidebar` value to position the global header to above the sidebar
- mountPoint: application/header/component
importName: SearchBar
config:
Expand Down
28 changes: 16 additions & 12 deletions packages/app/src/components/Root/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ import { makeStyles } from 'tss-react/mui';

import { policyEntityReadPermission } from '@janus-idp/backstage-plugin-rbac-common';

import DynamicRootContext, { MountPoints, ResolvedMenuItem } from '../DynamicRoot/DynamicRootContext';
import DynamicRootContext, {
MountPoints,
ResolvedMenuItem,
} from '../DynamicRoot/DynamicRootContext';
import { MenuIcon } from './MenuIcon';
import { SidebarLogo } from './SidebarLogo';

Expand Down Expand Up @@ -108,16 +111,14 @@ const ApplicationHeaders = ({
position: string;
}) => {
const appHeaderMountPoints = mountPoints['application/header'] ?? [];
return (
appHeaderMountPoints
?.filter(({ config }) => config?.layout?.position === position)
.map(({ Component, config }, index) => (
// eslint-disable-next-line react/no-array-index-key
<ErrorBoundary key={index}>
<Component {...config?.props} />
</ErrorBoundary>
))
);
return appHeaderMountPoints
?.filter(({ config }) => config?.layout?.position === position)
.map(({ Component, config }, index) => (
// eslint-disable-next-line react/no-array-index-key
<ErrorBoundary key={index}>
<Component {...config?.props} />
</ErrorBoundary>
));
};

export const Root = ({ children }: PropsWithChildren<{}>) => {
Expand Down Expand Up @@ -271,7 +272,10 @@ export const Root = ({ children }: PropsWithChildren<{}>) => {
<>
<ApplicationHeaders mountPoints={mountPoints} position="above-sidebar" />
<SidebarPage>
<ApplicationHeaders mountPoints={mountPoints} position="above-main-content" />
<ApplicationHeaders
mountPoints={mountPoints}
position="above-main-content"
/>
<Sidebar>
<SidebarLogo />
<SidebarGroup label="Search" icon={<SearchIcon />} to="/search">
Expand Down

0 comments on commit 1db34b3

Please sign in to comment.