Skip to content

Commit

Permalink
feat: support custom labels in sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe authored and moshloop committed Jan 8, 2025
1 parent d7066c2 commit e2dbfb6
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions common/src/theme/DocSidebarItem/Link/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,40 @@ export default function DocSidebarItemLink({
ThemeClassNames.docs.docSidebarItemLink,
ThemeClassNames.docs.docSidebarItemLinkLevel(level),
'menu__list-item',
className,
className
)}
key={label}>
key={label}
>
<Link
className={clsx(
'menu__link',
item.customProps?.icon && "gap-x-1 ml-[-10px]",
item.customProps?.icon && 'gap-x-1 ml-[-10px]',
!isInternalLink && styles.menuExternalLink,
{
'menu__link--active': isActive,
},
'menu__link--active': isActive
}
)}
autoAddBaseUrl={autoAddBaseUrl}
aria-current={isActive ? 'page' : undefined}
to={href}
{...(isInternalLink && {
onClick: onItemClick ? () => onItemClick(item) : undefined,
onClick: onItemClick ? () => onItemClick(item) : undefined
})}
{...props}>

{item.customProps?.icon && <Icon name={item.customProps.icon} className="h-5 w-auto " height={32}
style={{
fill: "var(--gray-500)"
}} />}
{label}
{...props}
>
{item.customProps?.icon && (
<Icon
name={item.customProps.icon}
className="h-5 w-auto "
height={32}
style={{
fill: 'var(--gray-500)'
}}
/>
)}
{item.customProps?.label ??label}
{!isInternalLink && <IconExternalLink />}
</Link>
</li>
);
)
}

0 comments on commit e2dbfb6

Please sign in to comment.