Skip to content

Commit

Permalink
Add 'hasSubmenu' so we can skip chevron for parents that don't have s…
Browse files Browse the repository at this point in the history
…ubmenu
  • Loading branch information
rushi committed Dec 23, 2024
1 parent e738a5d commit 6688de5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/components/Sidebar/Sidebar.Link.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import cn from "../../helpers/classnames";
import { ChevronRightIcon } from "../../icons";
import { Dot } from "../Dot/Dot";

export const SidebarLink = ({ isActive = false, icon: Icon, children, isSubMenuItem, align, classNames, ...rest }) => {
export const SidebarLink = ({ isActive = false, hasSubmenu = false, icon: Icon, children, isSubMenuItem, align, classNames, ...rest }) => {
return (
<button
type="button"
Expand Down Expand Up @@ -38,7 +38,7 @@ export const SidebarLink = ({ isActive = false, icon: Icon, children, isSubMenuI
{children}
</span>

{isSubMenuItem ? null : <ChevronRightIcon className="ml-auto hidden h-3 w-3 xl:inline" />}
{isSubMenuItem || !hasSubmenu ? null : <ChevronRightIcon className="ml-auto hidden h-3 w-3 xl:inline" />}
</button>
);
};
Expand All @@ -48,6 +48,7 @@ SidebarLink.displayName = "Sidebar.Link";
SidebarLink.propTypes = {
align: PropTypes.oneOf(["center", "left", "right"]),
isActive: PropTypes.bool,
hasSubmenu: PropTypes.bool,
icon: PropTypes.func,
children: PropTypes.node.isRequired,
isSubMenuItem: PropTypes.bool,
Expand Down
2 changes: 1 addition & 1 deletion src/stories/Navigation/Sidebar.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const Default = () => {
</div>
}
>
<Sidebar.Link icon={AnnounceIcon}>Marketing</Sidebar.Link>
<Sidebar.Link hasSubmenu icon={AnnounceIcon}>Marketing</Sidebar.Link>
</Sidebar.Menu>
</Sidebar>
</div>
Expand Down

0 comments on commit 6688de5

Please sign in to comment.