mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-25 04:20:02 +00:00
Core & UI: Support separators without name
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'fumadocs-core': patch
|
||||
'fumadocs-ui': patch
|
||||
---
|
||||
|
||||
Support separators without name
|
||||
@@ -66,7 +66,7 @@ export function getBreadcrumbItemsFromPath(
|
||||
let items: BreadcrumbItem[] = [];
|
||||
|
||||
path.forEach((item, i) => {
|
||||
if (item.type === 'separator' && includeSeparator) {
|
||||
if (item.type === 'separator' && item.name && includeSeparator) {
|
||||
items.push({
|
||||
name: item.name,
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@ export interface Separator {
|
||||
$id?: string;
|
||||
|
||||
type: 'separator';
|
||||
name: ReactNode;
|
||||
name?: ReactNode;
|
||||
icon?: ReactElement;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ export interface PageTreeBuilder {
|
||||
|
||||
const group = /^\((?<name>.+)\)$/;
|
||||
const link = /^(?:\[(?<icon>[^\]]+)])?\[(?<name>[^\]]+)]\((?<url>[^)]+)\)$/;
|
||||
const separator = /^---(?:\[(?<icon>[^\]]+)])?(?<name>.+)---$/;
|
||||
const separator = /^---(?:\[(?<icon>[^\]]+)])?(?<name>.+)---|^---$/;
|
||||
const rest = '...' as const;
|
||||
const restReversed = 'z...a' as const;
|
||||
const extractPrefix = '...';
|
||||
|
||||
@@ -227,7 +227,7 @@ export function SidebarSeparator(props: HTMLAttributes<HTMLParagraphElement>) {
|
||||
<p
|
||||
{...props}
|
||||
className={cn(
|
||||
'inline-flex items-center gap-2 mb-2 px-2 text-sm font-medium [&_svg]:size-4 [&_svg]:shrink-0',
|
||||
'inline-flex items-center gap-2 mb-2 px-2 text-sm font-medium empty:mb-0 [&_svg]:size-4 [&_svg]:shrink-0',
|
||||
props.className,
|
||||
)}
|
||||
style={{
|
||||
@@ -432,7 +432,7 @@ export function SidebarPageTree(props: {
|
||||
if (item.type === 'separator') {
|
||||
if (Separator) return <Separator key={i} item={item} />;
|
||||
return (
|
||||
<SidebarSeparator key={i} className={cn(i !== 0 && 'mt-8')}>
|
||||
<SidebarSeparator key={i} className={cn(i !== 0 && 'mt-6')}>
|
||||
{item.icon}
|
||||
{item.name}
|
||||
</SidebarSeparator>
|
||||
|
||||
Reference in New Issue
Block a user