mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-26 06:31:49 +00:00
Core: Disable single by default on fumadocs-core/toc API
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'fumadocs-core': minor
|
||||
---
|
||||
|
||||
Disable `single` by default on `fumadocs-core/toc` API
|
||||
@@ -39,7 +39,7 @@ export interface AnchorProviderProps {
|
||||
/**
|
||||
* Only accept one active item at most
|
||||
*
|
||||
* @defaultValue true
|
||||
* @defaultValue false
|
||||
*/
|
||||
single?: boolean;
|
||||
children?: ReactNode;
|
||||
@@ -57,7 +57,7 @@ export interface ScrollProviderProps {
|
||||
export function ScrollProvider({
|
||||
containerRef,
|
||||
children,
|
||||
}: ScrollProviderProps): React.ReactElement {
|
||||
}: ScrollProviderProps) {
|
||||
return (
|
||||
<ScrollContext.Provider value={containerRef}>
|
||||
{children}
|
||||
@@ -67,9 +67,9 @@ export function ScrollProvider({
|
||||
|
||||
export function AnchorProvider({
|
||||
toc,
|
||||
single = true,
|
||||
single = false,
|
||||
children,
|
||||
}: AnchorProviderProps): React.ReactElement {
|
||||
}: AnchorProviderProps) {
|
||||
const headings = useMemo(() => {
|
||||
return toc.map((item) => item.url.split('#')[1]);
|
||||
}, [toc]);
|
||||
|
||||
@@ -327,7 +327,7 @@ export function DocsLayout({
|
||||
<LayoutBody
|
||||
{...props.containerProps}
|
||||
className={cn(
|
||||
'md:[&_#nd-page_article]:pt-12 xl:[--fd-toc-width:286px] xl:[&_#nd-page_article]:px-8',
|
||||
'md:[&_#nd-page_article]:pt-12 xl:[&_#nd-page_article]:px-8',
|
||||
sidebarEnabled && sidebarVariables,
|
||||
props.containerProps?.className,
|
||||
)}
|
||||
|
||||
@@ -400,7 +400,7 @@ export function PageTOC(props: ComponentProps<'div'>) {
|
||||
id="nd-toc"
|
||||
{...props}
|
||||
className={cn(
|
||||
'fixed bottom-0 pt-12 pb-2 pr-(--removed-body-scroll-bar-size,0) max-xl:hidden',
|
||||
'fixed bottom-0 pt-12 pb-2 pr-(--removed-body-scroll-bar-size,0) xl:on-root:[--fd-toc-width:286px] max-xl:hidden',
|
||||
props.className,
|
||||
)}
|
||||
style={{
|
||||
|
||||
@@ -318,7 +318,7 @@ export function DocsLayout(props: DocsLayoutProps) {
|
||||
<LayoutBody
|
||||
{...props.containerProps}
|
||||
className={cn(
|
||||
'md:[--fd-sidebar-width:286px] xl:[--fd-toc-width:286px]',
|
||||
'md:[--fd-sidebar-width:286px]',
|
||||
props.containerProps?.className,
|
||||
)}
|
||||
>
|
||||
|
||||
@@ -149,10 +149,6 @@ export function DocsPage({
|
||||
: false
|
||||
}
|
||||
{...container}
|
||||
className={cn(
|
||||
!tocEnabled && '[--fd-toc-width:0px]',
|
||||
container?.className,
|
||||
)}
|
||||
>
|
||||
{tocPopoverEnabled &&
|
||||
(tocPopover ?? (
|
||||
|
||||
Reference in New Issue
Block a user