@@ -6,6 +6,8 @@ import {Divider, Spacer} from "@nextui-org/react";
6
6
import { ChevronCircleTopLinearIcon } from "@nextui-org/shared-icons" ;
7
7
import scrollIntoView from "scroll-into-view-if-needed" ;
8
8
9
+ import { NextUIProCallout } from "./nextui-pro-callout" ;
10
+
9
11
import { Heading } from "@/libs/docs/utils" ;
10
12
import { useScrollSpy } from "@/hooks/use-scroll-spy" ;
11
13
import { useScrollPosition } from "@/hooks/use-scroll-position" ;
@@ -65,64 +67,64 @@ export const DocsToc: FC<DocsTocProps> = ({headings}) => {
65
67
} , [ ] ) ;
66
68
67
69
return (
68
- < div
69
- ref = { tocRef }
70
- className = { clsx (
71
- "fixed w-full max-w-[12rem] flex flex-col gap-4 text-left pb-28 h-[calc(100vh-460px)] scrollbar-hide overflow-y-scroll" ,
72
- isProBannerVisible ? "top-32" : "top-20" ,
73
- ) }
74
- style = { {
75
- WebkitMaskImage : `linear-gradient(to top, transparent 0%, #000 100px, #000 ${
76
- scrollPosition > 30 ? "90%" : "100%"
77
- } , transparent 100%)`,
78
- } }
79
- >
80
- < p className = "text-sm font-medium" > On this page</ p >
81
- < ul className = "scrollbar-hide flex flex-col gap-2" >
82
- { headings . map (
83
- ( heading , i ) =>
84
- heading . level > 1 && (
85
- < li
86
- key = { i }
87
- className = { clsx (
88
- "transition-colors" ,
89
- "font-normal" ,
90
- "flex items-center text-tiny font-normal text-default-500 dark:text-default-300" ,
91
- "data-[active=true]:text-foreground" ,
92
- "dark:data-[active=true]:text-foreground" ,
93
- "before:content-['']" ,
94
- "before:opacity-0" ,
95
- "data-[active=true]:before:opacity-100" ,
96
- "before:transition-opacity" ,
97
- "before:-ml-3" ,
98
- "before:absolute" ,
99
- "before:bg-default-400" ,
100
- "before:w-1" ,
101
- "before:h-1" ,
102
- "before:rounded-full" ,
103
- paddingLeftByLevel [ heading . level ] ,
104
- ) }
105
- data-active = { activeId == heading . id }
106
- >
107
- < a href = { `#${ heading . id } ` } > { heading . text } </ a >
108
- </ li >
109
- ) ,
110
- ) }
111
- < li
112
- className = "mt-2 opacity-0 data-[visible=true]:opacity-100 transition-opacity"
113
- data-visible = { activeIndex >= 2 }
114
- >
115
- < Divider />
116
- < Spacer y = { 2 } />
117
- < a
118
- className = "flex gap-2 items-center text-tiny text-default-500 dark:text-foreground/30 hover:text-foreground/80 pl-4 transition-opacity"
119
- href = { `#${ firstId } ` }
70
+ < div className = { clsx ( "fixed" , isProBannerVisible ? "top-32" : "top-20" ) } >
71
+ < div
72
+ ref = { tocRef }
73
+ className = "w-full max-w-[12rem] max-h-[calc(100vh-500px)] flex flex-col gap-4 text-left pb-16 scrollbar-hide overflow-y-scroll"
74
+ style = { {
75
+ WebkitMaskImage : `linear-gradient(to top, transparent 0%, #000 100px, #000 ${
76
+ scrollPosition > 30 ? "90%" : "100%"
77
+ } , transparent 100%)`,
78
+ } }
79
+ >
80
+ < p className = "text-sm font-medium" > On this page</ p >
81
+ < ul className = "scrollbar-hide flex flex-col gap-2" >
82
+ { headings . map (
83
+ ( heading , i ) =>
84
+ heading . level > 1 && (
85
+ < li
86
+ key = { i }
87
+ className = { clsx (
88
+ "transition-colors" ,
89
+ "font-normal" ,
90
+ "flex items-center text-tiny font-normal text-default-500 dark:text-default-300" ,
91
+ "data-[active=true]:text-foreground" ,
92
+ "dark:data-[active=true]:text-foreground" ,
93
+ "before:content-['']" ,
94
+ "before:opacity-0" ,
95
+ "data-[active=true]:before:opacity-100" ,
96
+ "before:transition-opacity" ,
97
+ "before:-ml-3" ,
98
+ "before:absolute" ,
99
+ "before:bg-default-400" ,
100
+ "before:w-1" ,
101
+ "before:h-1" ,
102
+ "before:rounded-full" ,
103
+ paddingLeftByLevel [ heading . level ] ,
104
+ ) }
105
+ data-active = { activeId == heading . id }
106
+ >
107
+ < a href = { `#${ heading . id } ` } > { heading . text } </ a >
108
+ </ li >
109
+ ) ,
110
+ ) }
111
+ < li
112
+ className = "mt-2 opacity-0 data-[visible=true]:opacity-100 transition-opacity"
113
+ data-visible = { activeIndex >= 2 }
120
114
>
121
- Back to top
122
- < ChevronCircleTopLinearIcon />
123
- </ a >
124
- </ li >
125
- </ ul >
115
+ < Divider />
116
+ < Spacer y = { 2 } />
117
+ < a
118
+ className = "flex gap-2 items-center text-tiny text-default-500 dark:text-foreground/30 hover:text-foreground/80 pl-4 transition-opacity"
119
+ href = { `#${ firstId } ` }
120
+ >
121
+ Back to top
122
+ < ChevronCircleTopLinearIcon />
123
+ </ a >
124
+ </ li >
125
+ </ ul >
126
+ </ div >
127
+ < NextUIProCallout />
126
128
</ div >
127
129
) ;
128
130
} ;
0 commit comments