diff --git a/.changeset/eight-insects-tan.md b/.changeset/eight-insects-tan.md index 6f4d65275f..d9bb899225 100644 --- a/.changeset/eight-insects-tan.md +++ b/.changeset/eight-insects-tan.md @@ -2,4 +2,4 @@ '@backstage/core-components': patch --- -Add `LayoutProvider` component and `useLayoutContent` hook to have a reference to current main content element +Add `useContent` hook to have a reference to the current main content element diff --git a/packages/app/src/App.tsx b/packages/app/src/App.tsx index 421b21790c..59f107c70d 100644 --- a/packages/app/src/App.tsx +++ b/packages/app/src/App.tsx @@ -30,7 +30,6 @@ import { createApp } from '@backstage/app-defaults'; import { FlatRoutes } from '@backstage/core-app-api'; import { AlertDisplay, - LayoutProvider, OAuthRequestDialog, SignInPage, } from '@backstage/core-components'; @@ -226,13 +225,11 @@ const routes = ( const App = () => ( - - - - - {routes} - - + + + + {routes} + ); diff --git a/packages/core-components/api-report.md b/packages/core-components/api-report.md index 11eefcf8b4..19c8a737ec 100644 --- a/packages/core-components/api-report.md +++ b/packages/core-components/api-report.md @@ -571,11 +571,6 @@ enum LabelPosition { RIGHT = 'r', } -// Warning: (ae-missing-release-tag) "LayoutProvider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export function LayoutProvider(props: PropsWithChildren<{}>): JSX.Element; - // Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "Lifecycle" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -2406,10 +2401,10 @@ export function TrendLine( }, ): JSX.Element | null; -// Warning: (ae-missing-release-tag) "useLayoutContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "useContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export function useLayoutContent(): { +export function useContent(): { focusContent: () => void; contentRef: React_2.MutableRefObject | undefined; }; diff --git a/packages/core-components/src/layout/Sidebar/Bar.tsx b/packages/core-components/src/layout/Sidebar/Bar.tsx index 477aad9fc9..c5384c323d 100644 --- a/packages/core-components/src/layout/Sidebar/Bar.tsx +++ b/packages/core-components/src/layout/Sidebar/Bar.tsx @@ -23,11 +23,10 @@ import Button from '@material-ui/core/Button'; import { sidebarConfig, SidebarContext } from './config'; import { BackstageTheme } from '@backstage/theme'; -import { SidebarPinStateContext } from './Page'; +import { SidebarPinStateContext, useContent } from './Page'; import { MobileSidebar } from './MobileSidebar'; import DoubleArrowRight from './icons/DoubleArrowRight'; import DoubleArrowLeft from './icons/DoubleArrowLeft'; -import { useLayoutContent } from '../LayoutProvider/LayoutProvider'; /** @public */ export type SidebarClassKey = 'drawer' | 'drawerOpen'; @@ -230,7 +229,7 @@ export const Sidebar = (props: SidebarProps) => { }; function A11ySkipSidebar() { - const { focusContent, contentRef } = useLayoutContent(); + const { focusContent, contentRef } = useContent(); const classes = useStyles(); if (!contentRef?.current) { diff --git a/packages/core-components/src/layout/index.ts b/packages/core-components/src/layout/index.ts index 06ee5d1d4c..9bb7fbaa26 100644 --- a/packages/core-components/src/layout/index.ts +++ b/packages/core-components/src/layout/index.ts @@ -31,4 +31,3 @@ export * from './Sidebar'; export * from './SignInPage'; export * from './TabbedCard'; export * from './Breadcrumbs'; -export * from './LayoutProvider';