Skip to content

Commit 7027388

Browse files
authored
feat: Add navigation section separator component (#15436)
- Add section_end_divider frontmatter field - Add SidebarSeparator component to render horizontal dividers - Add separator styles (.sidebar-separator) - Update dynamicNav to render separators after items with section_end_divider - Update platformSidebar to map section_end_divider from frontmatter This allows documentation pages to add visual separators in the sidebar by setting section_end_divider: true in their frontmatter, helping to visually group related navigation sections. <img width="316" height="615" alt="CleanShot 2025-11-09 at 10  00 46@2x" src="https://github.com/user-attachments/assets/4e4b08f2-f71c-46d3-9cbd-7a69079071d5" />
1 parent 16ca3be commit 7027388

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

src/components/sidebar/dynamicNav.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ import {sortPages} from 'sentry-docs/utils';
55
import {getUnversionedPath, VERSION_INDICATOR} from 'sentry-docs/versioning';
66

77
import {CollapsibleSidebarLink} from './collapsibleSidebarLink';
8-
import {SidebarLink} from './sidebarLink';
8+
import {SidebarLink, SidebarSeparator} from './sidebarLink';
99

1010
type Node = {
1111
[key: string]: any;
1212
context: {
1313
[key: string]: any;
1414
beta?: boolean;
1515
new?: boolean;
16+
section_end_divider?: boolean;
1617
sidebar_hidden?: boolean;
1718
sidebar_order?: number;
1819
sidebar_title?: string;
@@ -98,6 +99,11 @@ export const renderChildren = (
9899
{renderChildren(nodeChildren, exclude, path, showDepth, depth + 1)}
99100
</CollapsibleSidebarLink>
100101
);
102+
103+
// Add separator after this item if section_end_divider is true
104+
if (node.context.section_end_divider && depth === 0) {
105+
result.push(<SidebarSeparator key={`separator-${node.path}`} />);
106+
}
101107
});
102108

103109
return result;

src/components/sidebar/platformSidebar.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export function PlatformSidebar({
2424
sidebar_hidden: n.frontmatter.sidebar_hidden,
2525
beta: n.frontmatter.beta,
2626
new: n.frontmatter.new,
27+
section_end_divider: n.frontmatter.section_end_divider,
2728
},
2829
path: '/' + n.path + '/',
2930
};

src/components/sidebar/sidebarLink.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ export function SidebarLink({
4848
}
4949

5050
export function SidebarSeparator() {
51-
return <hr className={styles['sidebar-separator']} />;
51+
return <hr className={`${styles['sidebar-separator']} mt-3 mb-3`} />;
5252
}

src/components/sidebar/style.module.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,5 @@
205205
}
206206

207207
.sidebar-separator {
208-
margin: 1rem 0;
209-
border: none;
210-
border-top: 1px solid var(--border-color);
208+
border-top: 2px solid var(--gray-6);
211209
}

0 commit comments

Comments
 (0)