diff --git a/.changeset/mean-turtles-reply.md b/.changeset/mean-turtles-reply.md new file mode 100644 index 0000000000..f3b21989d1 --- /dev/null +++ b/.changeset/mean-turtles-reply.md @@ -0,0 +1,5 @@ +--- +'@backstage/core-components': patch +--- + +Fix issue where right arrow icon was incorrectly added to side bar items without a sub-menu diff --git a/packages/core-components/src/layout/Sidebar/Items.tsx b/packages/core-components/src/layout/Sidebar/Items.tsx index c004f6904c..fde3c85c96 100644 --- a/packages/core-components/src/layout/Sidebar/Items.tsx +++ b/packages/core-components/src/layout/Sidebar/Items.tsx @@ -259,6 +259,7 @@ type SidebarItemBaseProps = { icon: IconComponent; text?: string; hasNotifications?: boolean; + hasSubmenu?: boolean; disableHighlight?: boolean; className?: string; }; @@ -356,6 +357,7 @@ const SidebarItemBase = forwardRef((props, ref) => { icon: Icon, text, hasNotifications = false, + hasSubmenu = false, disableHighlight = false, onClick, children, @@ -370,12 +372,12 @@ const SidebarItemBase = forwardRef((props, ref) => { const { isOpen } = useContext(SidebarContext); const divStyle = - !isOpen && children ? { display: 'flex', marginLeft: '24px' } : {}; + !isOpen && hasSubmenu ? { display: 'flex', marginLeft: '24px' } : {}; const displayItemIcon = (
- {!isOpen && children ? : <>} + {!isOpen && hasSubmenu ? : <>}
); @@ -492,6 +494,7 @@ const SidebarItemWithSubmenu = ({ className={classnames(isHoveredOn && classes.highlighted)} >