Skip to content

Commit 674c8d5

Browse files
authored
portal: Fix sidebar spacing on top (#8666)
1 parent 1eb0cd9 commit 674c8d5

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

apps/portal/src/components/Layouts/DocLayout.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export function DocLayout(props: DocLayoutProps) {
4949
<DocSidebar
5050
{...props.sideBar}
5151
header={props.sidebarHeader}
52-
className="pt-1"
5352
/>
5453
</aside>
5554
)}

apps/portal/src/components/others/Sidebar.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ export function DocSidebar(props: ReferenceSideBarProps) {
6868
{props.links.map((link, i) => (
6969
// biome-ignore lint/suspicious/noArrayIndexKey: TODO - fix this
7070
<li key={i}>
71-
<SidebarItem link={link} onLinkClick={props.onLinkClick} />
71+
<SidebarItem link={link} onLinkClick={props.onLinkClick} isFirst={i === 0} />
7272
</li>
7373
))}
7474
</ul>
7575
</div>
7676
);
7777
}
7878

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

8282
if ("separator" in props.link) {
@@ -92,6 +92,7 @@ function SidebarItem(props: { link: SidebarLink; onLinkClick?: () => void }) {
9292
if (link.isCollapsible === false) {
9393
return (
9494
<DocSidebarNonCollapsible
95+
isFirst={props.isFirst}
9596
key={link.name}
9697
linkGroup={link}
9798
onLinkClick={props.onLinkClick}
@@ -145,13 +146,14 @@ function SidebarItem(props: { link: SidebarLink; onLinkClick?: () => void }) {
145146
function DocSidebarNonCollapsible(props: {
146147
linkGroup: LinkGroup;
147148
onLinkClick?: () => void;
149+
isFirst: boolean;
148150
}) {
149151
const pathname = usePathname();
150152
const { href, name, links, icon } = props.linkGroup;
151153
const isCategoryActive = href ? isSamePage(pathname, href) : false;
152154

153155
return (
154-
<div className="my-4">
156+
<div className={cn("my-4", props.isFirst && "mt-0")}>
155157
<div className="mb-2 flex items-center gap-2 rounded-lg text-foreground">
156158
{icon && <SidebarIcon icon={icon} />}
157159
{href ? (
@@ -173,7 +175,7 @@ function DocSidebarNonCollapsible(props: {
173175
return (
174176
// biome-ignore lint/suspicious/noArrayIndexKey: TODO - fix this
175177
<li key={i}>
176-
<SidebarItem link={link} onLinkClick={props.onLinkClick} />
178+
<SidebarItem link={link} onLinkClick={props.onLinkClick} isFirst={i === 0} />
177179
</li>
178180
);
179181
})}
@@ -238,7 +240,7 @@ function DocSidebarCategory(props: {
238240
return (
239241
// biome-ignore lint/suspicious/noArrayIndexKey: TODO - fix this
240242
<li key={i}>
241-
<SidebarItem link={link} onLinkClick={props.onLinkClick} />
243+
<SidebarItem link={link} onLinkClick={props.onLinkClick} isFirst={i === 0} />
242244
</li>
243245
);
244246
})}

0 commit comments

Comments
 (0)