diff --git a/packages/core-components/api-report.md b/packages/core-components/api-report.md index 63cd694d28..a5f2010758 100644 --- a/packages/core-components/api-report.md +++ b/packages/core-components/api-report.md @@ -809,6 +809,11 @@ export const Sidebar: ({ export const SIDEBAR_INTRO_LOCAL_STORAGE = '@backstage/core/sidebar-intro-dismissed'; +// Warning: (ae-missing-release-tag) "SidebarClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type SidebarClassKey = 'drawer' | 'drawerOpen'; + // Warning: (ae-missing-release-tag) "sidebarConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) @@ -838,7 +843,7 @@ export const SidebarContext: Context; // @public (undocumented) export type SidebarContextType = { isOpen: boolean; - setOpen: (open: boolean) => void; + setOpen?: (open: boolean) => void; }; // Warning: (ae-missing-release-tag) "SidebarDivider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -1110,6 +1115,9 @@ export const SidebarDivider: React_2.ComponentType< } >; +// @public +export const SidebarExpandButton: () => JSX.Element | null; + // Warning: (ae-missing-release-tag) "SidebarGroup" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) @@ -1131,9 +1139,6 @@ export interface SidebarGroupProps extends BottomNavigationActionProps { to?: string; } -// @public -export const SidebarExpandButton: () => JSX.Element | null; - // Warning: (ae-missing-release-tag) "SidebarIntro" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) diff --git a/packages/core-components/src/layout/Sidebar/Bar.tsx b/packages/core-components/src/layout/Sidebar/Bar.tsx index f1d1b73be4..647495a6f1 100644 --- a/packages/core-components/src/layout/Sidebar/Bar.tsx +++ b/packages/core-components/src/layout/Sidebar/Bar.tsx @@ -178,18 +178,8 @@ export const Sidebar = ({ children }: React.PropsWithChildren) => { theme.breakpoints.down('xs'), ); - // TODO: Generalize - const setOpen = () => {}; - return isMobileScreen ? ( - - {children} - + {children} ) : ( {children} ); @@ -209,14 +199,14 @@ export const SidebarExpandButton = () => { theme.breakpoints.down('md'), ); + if (isPinned || isSmallScreen || !setOpen) { + return null; + } + const handleClick = () => { setOpen(!isOpen); }; - if (isPinned || isSmallScreen) { - return null; - } - return (