Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/portal/src/components/Layouts/DocLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export function DocLayout(props: DocLayoutProps) {
<DocSidebar
{...props.sideBar}
header={props.sidebarHeader}
className="pt-1"
/>
</aside>
)}
Expand Down
12 changes: 7 additions & 5 deletions apps/portal/src/components/others/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ export function DocSidebar(props: ReferenceSideBarProps) {
{props.links.map((link, i) => (
// biome-ignore lint/suspicious/noArrayIndexKey: TODO - fix this
<li key={i}>
<SidebarItem link={link} onLinkClick={props.onLinkClick} />
<SidebarItem link={link} onLinkClick={props.onLinkClick} isFirst={i === 0} />
</li>
))}
</ul>
</div>
);
}

function SidebarItem(props: { link: SidebarLink; onLinkClick?: () => void }) {
function SidebarItem(props: { link: SidebarLink; onLinkClick?: () => void, isFirst: boolean }) {
const pathname = usePathname();

if ("separator" in props.link) {
Expand All @@ -92,6 +92,7 @@ function SidebarItem(props: { link: SidebarLink; onLinkClick?: () => void }) {
if (link.isCollapsible === false) {
return (
<DocSidebarNonCollapsible
isFirst={props.isFirst}
key={link.name}
linkGroup={link}
onLinkClick={props.onLinkClick}
Expand Down Expand Up @@ -145,13 +146,14 @@ function SidebarItem(props: { link: SidebarLink; onLinkClick?: () => void }) {
function DocSidebarNonCollapsible(props: {
linkGroup: LinkGroup;
onLinkClick?: () => void;
isFirst: boolean;
}) {
const pathname = usePathname();
const { href, name, links, icon } = props.linkGroup;
const isCategoryActive = href ? isSamePage(pathname, href) : false;

return (
<div className="my-4">
<div className={cn("my-4", props.isFirst && "mt-0")}>
<div className="mb-2 flex items-center gap-2 rounded-lg text-foreground">
{icon && <SidebarIcon icon={icon} />}
{href ? (
Expand All @@ -173,7 +175,7 @@ function DocSidebarNonCollapsible(props: {
return (
// biome-ignore lint/suspicious/noArrayIndexKey: TODO - fix this
<li key={i}>
<SidebarItem link={link} onLinkClick={props.onLinkClick} />
<SidebarItem link={link} onLinkClick={props.onLinkClick} isFirst={i === 0} />
</li>
);
})}
Expand Down Expand Up @@ -238,7 +240,7 @@ function DocSidebarCategory(props: {
return (
// biome-ignore lint/suspicious/noArrayIndexKey: TODO - fix this
<li key={i}>
<SidebarItem link={link} onLinkClick={props.onLinkClick} />
<SidebarItem link={link} onLinkClick={props.onLinkClick} isFirst={i === 0} />
</li>
);
})}
Expand Down