diff --git a/packages/app/src/components/Root/Root.tsx b/packages/app/src/components/Root/Root.tsx index 8b1ce76cbd..453c98bc72 100644 --- a/packages/app/src/components/Root/Root.tsx +++ b/packages/app/src/components/Root/Root.tsx @@ -86,14 +86,14 @@ const Root: FC<{}> = ({ children }) => ( {/* Global nav, not org-specific */} - - - + + + {/* End global nav */} - - - + + + diff --git a/packages/core-api/src/app/App.tsx b/packages/core-api/src/app/App.tsx index d7920e6bbd..1923adba0d 100644 --- a/packages/core-api/src/app/App.tsx +++ b/packages/core-api/src/app/App.tsx @@ -205,7 +205,11 @@ export class PrivateAppImpl implements BackstageApp { - {children} + + + {children}} /> + + diff --git a/packages/core/src/layout/Sidebar/Items.tsx b/packages/core/src/layout/Sidebar/Items.tsx index 5c2909f82e..a7f40f56ba 100644 --- a/packages/core/src/layout/Sidebar/Items.tsx +++ b/packages/core/src/layout/Sidebar/Items.tsx @@ -111,8 +111,8 @@ const useStyles = makeStyles(theme => { type SidebarItemProps = { icon: IconComponent; text?: string; + // If 'to' is set the item will act as a nav link with highlight, otherwise it's just a button to?: string; - disableSelected?: boolean; hasNotifications?: boolean; onClick?: () => void; }; @@ -120,9 +120,7 @@ type SidebarItemProps = { export const SidebarItem: FC = ({ icon: Icon, text, - to = '#', - // TODO: isActive is not in v6 - // disableSelected = false, + to, hasNotifications = false, onClick, children, @@ -144,27 +142,25 @@ export const SidebarItem: FC = ({ ); + const childProps = { + onClick, + className: clsx(classes.root, isOpen ? classes.open : classes.closed), + }; + if (!isOpen) { + if (to === undefined) { + return
{itemIcon}
; + } + return ( - + {itemIcon} ); } - return ( - + + const content = ( + <>
{itemIcon}
@@ -174,6 +170,16 @@ export const SidebarItem: FC = ({ )}
{children}
+ + ); + + if (to === undefined) { + return
{content}
; + } + + return ( + + {content} ); }; @@ -198,7 +204,7 @@ export const SidebarSearchField: FC = props => { return (
- + = ({ title, icon, signedIn, api, signInHandler }) => { return ( - + (signedIn ? api.logout() : signInHandler())}> = ({ text={displayName} onClick={handleClick} icon={avatar || AccountCircleIcon} - disableSelected > {open ? : }