@docubook/create 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/dist/app/docs/[[...slug]]/page.tsx +56 -63
- package/src/dist/app/docs/layout.tsx +11 -4
- package/src/dist/app/layout.tsx +10 -9
- package/src/dist/app/page.tsx +3 -22
- package/src/dist/components/{context-popover.tsx → ContextPopover.tsx} +4 -3
- package/src/dist/components/{docs-breadcrumb.tsx → DocsBreadcrumb.tsx} +1 -1
- package/src/dist/components/{docs-menu.tsx → DocsMenu.tsx} +2 -2
- package/src/dist/components/DocsNavbar.tsx +46 -0
- package/src/dist/components/DocsSidebar.tsx +196 -0
- package/src/dist/components/Github.tsx +26 -0
- package/src/dist/components/{scroll-to-top.tsx → ScrollToTop.tsx} +16 -9
- package/src/dist/components/SearchBox.tsx +37 -0
- package/src/dist/components/SearchContext.tsx +47 -0
- package/src/dist/components/SearchModal.tsx +2 -2
- package/src/dist/components/SearchTrigger.tsx +5 -5
- package/src/dist/components/Sponsor.tsx +2 -2
- package/src/dist/components/{theme-toggle.tsx → ThemeToggle.tsx} +10 -10
- package/src/dist/components/TocObserver.tsx +197 -0
- package/src/dist/components/footer.tsx +16 -12
- package/src/dist/components/leftbar.tsx +45 -73
- package/src/dist/components/markdown/AccordionGroupMdx.tsx +1 -1
- package/src/dist/components/markdown/AccordionMdx.tsx +4 -4
- package/src/dist/components/markdown/CardMdx.tsx +4 -4
- package/src/dist/components/markdown/FileTreeMdx.tsx +4 -4
- package/src/dist/components/markdown/ImageMdx.tsx +1 -1
- package/src/dist/components/markdown/ReleaseMdx.tsx +1 -1
- package/src/dist/components/markdown/TooltipsMdx.tsx +1 -1
- package/src/dist/components/navbar.tsx +130 -53
- package/src/dist/components/sublink.tsx +1 -1
- package/src/dist/components/toc.tsx +16 -14
- package/src/dist/components/typography.tsx +1 -1
- package/src/dist/components/ui/icon-cloud.tsx +353 -0
- package/src/dist/components/ui/scroll-area.tsx +2 -2
- package/src/dist/components/ui/sheet.tsx +4 -4
- package/src/dist/components/ui/toggle.tsx +3 -3
- package/src/dist/docs/components/accordion-group.mdx +68 -0
- package/src/dist/docs/components/accordion.mdx +59 -0
- package/src/dist/docs/components/button.mdx +40 -0
- package/src/dist/docs/components/card-group.mdx +47 -0
- package/src/dist/docs/components/card.mdx +68 -0
- package/src/dist/docs/components/code-block.mdx +67 -0
- package/src/dist/docs/components/custom.mdx +38 -0
- package/src/dist/docs/components/file-tree.mdx +109 -0
- package/src/dist/docs/components/image.mdx +37 -0
- package/src/dist/docs/components/index.mdx +9 -0
- package/src/dist/docs/components/keyboard.mdx +117 -0
- package/src/dist/docs/components/link.mdx +34 -0
- package/src/dist/docs/components/note.mdx +44 -0
- package/src/dist/docs/components/release-note.mdx +114 -0
- package/src/dist/docs/components/stepper.mdx +45 -0
- package/src/dist/docs/components/tables.mdx +35 -0
- package/src/dist/docs/components/tabs.mdx +72 -0
- package/src/dist/docs/components/tooltips.mdx +22 -0
- package/src/dist/docs/components/youtube.mdx +23 -0
- package/src/dist/docs/getting-started/introduction.mdx +18 -0
- package/src/dist/docs/getting-started/quick-start-guide.mdx +60 -0
- package/src/dist/docu.json +36 -33
- package/src/dist/eslint.config.mjs +17 -30
- package/src/dist/hooks/useActiveSection.ts +34 -32
- package/src/dist/hooks/useScrollPosition.ts +16 -14
- package/src/dist/lib/markdown.ts +32 -17
- package/src/dist/lib/utils.ts +1 -1
- package/src/dist/next.config.mjs +10 -11
- package/src/dist/package.json +1 -1
- package/src/dist/styles/algolia.css +11 -9
- package/src/dist/styles/{syntax.css → override.css} +82 -39
- package/src/dist/tailwind.config.ts +11 -110
- package/src/dist/components/GithubStart.tsx +0 -44
- package/src/dist/components/mob-toc.tsx +0 -134
- package/src/dist/components/search.tsx +0 -55
- package/src/dist/components/toc-observer.tsx +0 -254
- package/src/dist/docs/api-reference/delete/index.mdx +0 -63
- package/src/dist/docs/api-reference/fetch/index.mdx +0 -63
- package/src/dist/docs/api-reference/get/index.mdx +0 -63
- package/src/dist/docs/api-reference/post/index.mdx +0 -63
- package/src/dist/docs/changelog/index.mdx +0 -49
- package/src/dist/docs/getting-started/development/index.mdx +0 -92
- package/src/dist/docs/getting-started/introduction/index.mdx +0 -92
- package/src/dist/docs/getting-started/quick-start-guide/index.mdx +0 -92
- /package/src/dist/components/{edit-on-github.tsx → EditWithGithub.tsx} +0 -0
- /package/src/dist/components/{contexts/theme-provider.tsx → ThemeProvider.tsx} +0 -0
- /package/src/dist/{components/contexts/AccordionContext.ts → lib/accordion-context.ts} +0 -0
- /package/src/dist/lib/{routes-config.ts → routes.ts} +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { Dialog } from "@/components/ui/dialog"
|
|
4
|
+
import { SearchTrigger } from "@/components/SearchTrigger"
|
|
5
|
+
import { SearchModal } from "@/components/SearchModal"
|
|
6
|
+
import DocSearchComponent from "@/components/DocSearch"
|
|
7
|
+
import { useSearch } from "./SearchContext"
|
|
8
|
+
import { DialogTrigger } from "@/components/ui/dialog"
|
|
9
|
+
|
|
10
|
+
interface SearchProps {
|
|
11
|
+
/**
|
|
12
|
+
* Specify which search engine to use.
|
|
13
|
+
* @default 'default'
|
|
14
|
+
*/
|
|
15
|
+
type?: "default" | "algolia"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default function Search({ type = "default" }: SearchProps) {
|
|
19
|
+
const { isOpen, setIsOpen } = useSearch()
|
|
20
|
+
|
|
21
|
+
if (type === "algolia") {
|
|
22
|
+
// Just render the component without passing any state props
|
|
23
|
+
return <DocSearchComponent />
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Logic for 'default' search
|
|
27
|
+
return (
|
|
28
|
+
<div>
|
|
29
|
+
<Dialog open={isOpen} onOpenChange={setIsOpen}>
|
|
30
|
+
<DialogTrigger asChild>
|
|
31
|
+
<SearchTrigger />
|
|
32
|
+
</DialogTrigger>
|
|
33
|
+
<SearchModal isOpen={isOpen} setIsOpen={setIsOpen} />
|
|
34
|
+
</Dialog>
|
|
35
|
+
</div>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext, useState, useEffect, useCallback } from "react";
|
|
4
|
+
|
|
5
|
+
interface SearchContextType {
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
setIsOpen: (open: boolean) => void;
|
|
8
|
+
toggle: () => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const SearchContext = createContext<SearchContextType | undefined>(undefined);
|
|
12
|
+
|
|
13
|
+
export function SearchProvider({ children }: { children: React.ReactNode }) {
|
|
14
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
15
|
+
|
|
16
|
+
const toggle = useCallback(() => {
|
|
17
|
+
setIsOpen((prev) => !prev);
|
|
18
|
+
}, []);
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
|
22
|
+
if ((event.ctrlKey || event.metaKey) && event.key === "k") {
|
|
23
|
+
event.preventDefault();
|
|
24
|
+
toggle();
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
29
|
+
return () => {
|
|
30
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
31
|
+
};
|
|
32
|
+
}, [toggle]);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<SearchContext.Provider value={{ isOpen, setIsOpen, toggle }}>
|
|
36
|
+
{children}
|
|
37
|
+
</SearchContext.Provider>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function useSearch() {
|
|
42
|
+
const context = useContext(SearchContext);
|
|
43
|
+
if (!context) {
|
|
44
|
+
throw new Error("useSearch must be used within a SearchProvider");
|
|
45
|
+
}
|
|
46
|
+
return context;
|
|
47
|
+
}
|
|
@@ -6,7 +6,7 @@ import { ArrowUpIcon, ArrowDownIcon, CornerDownLeftIcon, FileTextIcon } from "lu
|
|
|
6
6
|
import Anchor from "./anchor";
|
|
7
7
|
import { advanceSearch, cn } from "@/lib/utils";
|
|
8
8
|
import { ScrollArea } from "@/components/ui/scroll-area";
|
|
9
|
-
import { page_routes } from "@/lib/routes
|
|
9
|
+
import { page_routes } from "@/lib/routes";
|
|
10
10
|
import {
|
|
11
11
|
DialogContent,
|
|
12
12
|
DialogHeader,
|
|
@@ -110,7 +110,7 @@ export function SearchModal({ isOpen, setIsOpen }: SearchModalProps) {
|
|
|
110
110
|
}, [selectedIndex]);
|
|
111
111
|
|
|
112
112
|
return (
|
|
113
|
-
<DialogContent className="p-0 max-w-[650px] sm:top-[38%] top-[45%]
|
|
113
|
+
<DialogContent className="p-0 max-w-[650px] sm:top-[38%] top-[45%] rounded-md!">
|
|
114
114
|
<DialogHeader>
|
|
115
115
|
<DialogTitle className="sr-only">Search Documentation</DialogTitle>
|
|
116
116
|
<DialogDescription className="sr-only">Search through the documentation</DialogDescription>
|
|
@@ -7,13 +7,13 @@ import { Input } from "@/components/ui/input";
|
|
|
7
7
|
export function SearchTrigger() {
|
|
8
8
|
return (
|
|
9
9
|
<DialogTrigger asChild>
|
|
10
|
-
<div className="relative flex-1 cursor-pointer
|
|
10
|
+
<div className="relative flex-1 cursor-pointer">
|
|
11
11
|
<div className="flex items-center">
|
|
12
|
-
<div className="
|
|
13
|
-
<SearchIcon className="h-
|
|
12
|
+
<div className="lg:hidden block p-2 -ml-2">
|
|
13
|
+
<SearchIcon className="h-6 w-6 text-muted-foreground" />
|
|
14
14
|
</div>
|
|
15
|
-
<div className="hidden
|
|
16
|
-
<SearchIcon className="absolute left-3 top-1/2 -translate-y-1/2 h-
|
|
15
|
+
<div className="hidden lg:block w-full">
|
|
16
|
+
<SearchIcon className="absolute left-3 top-1/2 -translate-y-1/2 h-6 w-6 text-muted-foreground" />
|
|
17
17
|
<Input
|
|
18
18
|
className="w-full rounded-full dark:bg-background/95 bg-background border h-9 pl-10 pr-0 sm:pr-4 text-sm shadow-sm overflow-ellipsis"
|
|
19
19
|
placeholder="Search"
|
|
@@ -89,7 +89,7 @@ export function Sponsor() {
|
|
|
89
89
|
// Safely get sponsor data with optional chaining and default values
|
|
90
90
|
const sponsor = docuConfig?.sponsor || {};
|
|
91
91
|
const item = sponsor?.item;
|
|
92
|
-
|
|
92
|
+
|
|
93
93
|
// Return null if required fields are missing
|
|
94
94
|
if (!item?.url || !item?.image || !item?.title) {
|
|
95
95
|
return null;
|
|
@@ -106,7 +106,7 @@ export function Sponsor() {
|
|
|
106
106
|
rel="noopener noreferrer"
|
|
107
107
|
className="flex flex-col justify-center gap-2 p-4 border rounded-lg hover:shadow transition-shadow"
|
|
108
108
|
>
|
|
109
|
-
<div className="relative w-8 h-8
|
|
109
|
+
<div className="relative w-8 h-8 shrink-0">
|
|
110
110
|
<Image
|
|
111
111
|
src={item.image}
|
|
112
112
|
alt={item.title}
|
|
@@ -17,9 +17,9 @@ export function ModeToggle() {
|
|
|
17
17
|
// Jika belum mounted, jangan render apapun untuk menghindari mismatch
|
|
18
18
|
if (!mounted) {
|
|
19
19
|
return (
|
|
20
|
-
<div className="flex items-center gap-1 rounded-full border border-border bg-background/50 p-
|
|
21
|
-
<div className="rounded-full p-
|
|
22
|
-
<div className="rounded-full p-
|
|
20
|
+
<div className="flex items-center gap-1 rounded-full border border-border bg-background/50 p-0.5">
|
|
21
|
+
<div className="rounded-full p-0 w-1 h-1" />
|
|
22
|
+
<div className="rounded-full p-0 w-1 h-1" />
|
|
23
23
|
</div>
|
|
24
24
|
);
|
|
25
25
|
}
|
|
@@ -43,29 +43,29 @@ export function ModeToggle() {
|
|
|
43
43
|
type="single"
|
|
44
44
|
value={activeTheme}
|
|
45
45
|
onValueChange={handleToggle}
|
|
46
|
-
className="flex items-center gap-1 rounded-full border border-border bg-background/50 p-
|
|
46
|
+
className="flex items-center gap-1 rounded-full border border-border bg-background/50 p-0.5 transition-all"
|
|
47
47
|
>
|
|
48
48
|
<ToggleGroupItem
|
|
49
49
|
value="light"
|
|
50
|
-
size="
|
|
50
|
+
size="xs"
|
|
51
51
|
aria-label="Light Mode"
|
|
52
|
-
className={`rounded-full cursor-pointer p-
|
|
52
|
+
className={`rounded-full cursor-pointer p-0.5 transition-all ${activeTheme === "light"
|
|
53
53
|
? "bg-primary text-primary-foreground"
|
|
54
54
|
: "bg-transparent hover:bg-muted/50"
|
|
55
55
|
}`}
|
|
56
56
|
>
|
|
57
|
-
<Sun className="h-
|
|
57
|
+
<Sun className="h-0.5 w-0.5" />
|
|
58
58
|
</ToggleGroupItem>
|
|
59
59
|
<ToggleGroupItem
|
|
60
60
|
value="dark"
|
|
61
|
-
size="
|
|
61
|
+
size="xs"
|
|
62
62
|
aria-label="Dark Mode"
|
|
63
|
-
className={`rounded-full cursor-pointer p-
|
|
63
|
+
className={`rounded-full cursor-pointer p-0.5 transition-all ${activeTheme === "dark"
|
|
64
64
|
? "bg-primary text-primary-foreground"
|
|
65
65
|
: "bg-transparent hover:bg-muted/50"
|
|
66
66
|
}`}
|
|
67
67
|
>
|
|
68
|
-
<Moon className="h-
|
|
68
|
+
<Moon className="h-0.5 w-0.5" />
|
|
69
69
|
</ToggleGroupItem>
|
|
70
70
|
</ToggleGroup>
|
|
71
71
|
);
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import clsx from "clsx"
|
|
4
|
+
import Link from "next/link"
|
|
5
|
+
import { useState, useRef, useEffect, useCallback } from "react"
|
|
6
|
+
import { motion } from "framer-motion"
|
|
7
|
+
import { ScrollToTop } from "./ScrollToTop"
|
|
8
|
+
import { TocItem } from "@/lib/toc"
|
|
9
|
+
|
|
10
|
+
interface TocObserverProps {
|
|
11
|
+
data: TocItem[]
|
|
12
|
+
activeId?: string | null
|
|
13
|
+
onActiveIdChange?: (id: string | null) => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default function TocObserver({
|
|
17
|
+
data,
|
|
18
|
+
activeId: externalActiveId,
|
|
19
|
+
onActiveIdChange,
|
|
20
|
+
}: TocObserverProps) {
|
|
21
|
+
const itemRefs = useRef<Map<string, HTMLAnchorElement>>(new Map())
|
|
22
|
+
|
|
23
|
+
const activeId = externalActiveId ?? null
|
|
24
|
+
|
|
25
|
+
const handleLinkClick = useCallback(
|
|
26
|
+
(id: string) => {
|
|
27
|
+
onActiveIdChange?.(id)
|
|
28
|
+
},
|
|
29
|
+
[onActiveIdChange]
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
// Function to check if an item has children
|
|
33
|
+
const hasChildren = (currentId: string, currentLevel: number) => {
|
|
34
|
+
const currentIndex = data.findIndex((item) => item.href.slice(1) === currentId)
|
|
35
|
+
if (currentIndex === -1 || currentIndex === data.length - 1) return false
|
|
36
|
+
|
|
37
|
+
const nextItem = data[currentIndex + 1]
|
|
38
|
+
return nextItem.level > currentLevel
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Calculate scroll progress for the active section
|
|
42
|
+
const [scrollProgress, setScrollProgress] = useState(0)
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
const handleScroll = () => {
|
|
46
|
+
if (!activeId) return
|
|
47
|
+
|
|
48
|
+
const activeElement = document.getElementById(activeId)
|
|
49
|
+
if (!activeElement) return
|
|
50
|
+
|
|
51
|
+
const rect = activeElement.getBoundingClientRect()
|
|
52
|
+
const windowHeight = window.innerHeight
|
|
53
|
+
const elementTop = rect.top
|
|
54
|
+
const elementHeight = rect.height
|
|
55
|
+
|
|
56
|
+
// Calculate how much of the element is visible
|
|
57
|
+
let progress = 0
|
|
58
|
+
if (elementTop < windowHeight) {
|
|
59
|
+
progress = Math.min(1, (windowHeight - elementTop) / (windowHeight + elementHeight))
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
setScrollProgress(progress)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const container = document.getElementById("scroll-container") || window
|
|
66
|
+
|
|
67
|
+
container.addEventListener("scroll", handleScroll, { passive: true })
|
|
68
|
+
|
|
69
|
+
// Initial calculation
|
|
70
|
+
handleScroll()
|
|
71
|
+
|
|
72
|
+
return () => container.removeEventListener("scroll", handleScroll)
|
|
73
|
+
}, [activeId])
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<div className="relative">
|
|
77
|
+
<div className="text-foreground/70 hover:text-foreground relative text-sm transition-colors">
|
|
78
|
+
<div className="flex flex-col gap-0">
|
|
79
|
+
{data.map(({ href, level, text }, index) => {
|
|
80
|
+
const id = href.slice(1)
|
|
81
|
+
const isActive = activeId === id
|
|
82
|
+
const indent = level > 1 ? (level - 1) * 20 : 0
|
|
83
|
+
// Prefix with underscore to indicate intentionally unused
|
|
84
|
+
const _isParent = hasChildren(id, level)
|
|
85
|
+
const _isLastInLevel = index === data.length - 1 || data[index + 1].level <= level
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<div key={href} className="relative">
|
|
89
|
+
{/* Simple L-shaped connector */}
|
|
90
|
+
{level > 1 && (
|
|
91
|
+
<div
|
|
92
|
+
className={clsx("absolute top-0 h-full w-6", {
|
|
93
|
+
"left-[6px]": indent === 20, // Level 2
|
|
94
|
+
"left-[22px]": indent === 40, // Level 3
|
|
95
|
+
"left-[38px]": indent === 60, // Level 4
|
|
96
|
+
})}
|
|
97
|
+
>
|
|
98
|
+
{/* Vertical line */}
|
|
99
|
+
<div
|
|
100
|
+
className={clsx(
|
|
101
|
+
"absolute left-0 top-0 h-full w-px",
|
|
102
|
+
isActive
|
|
103
|
+
? "bg-primary/20 dark:bg-primary/30"
|
|
104
|
+
: "bg-border/50 dark:bg-border/50"
|
|
105
|
+
)}
|
|
106
|
+
>
|
|
107
|
+
{isActive && (
|
|
108
|
+
<motion.div
|
|
109
|
+
className="bg-primary absolute left-0 top-0 h-full w-full origin-top"
|
|
110
|
+
initial={{ scaleY: 0 }}
|
|
111
|
+
animate={{ scaleY: scrollProgress }}
|
|
112
|
+
transition={{ duration: 0.3 }}
|
|
113
|
+
/>
|
|
114
|
+
)}
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
{/* Horizontal line */}
|
|
118
|
+
<div
|
|
119
|
+
className={clsx(
|
|
120
|
+
"absolute left-0 top-1/2 h-px w-6",
|
|
121
|
+
isActive
|
|
122
|
+
? "bg-primary/20 dark:bg-primary/30"
|
|
123
|
+
: "bg-border/50 dark:bg-border/50"
|
|
124
|
+
)}
|
|
125
|
+
>
|
|
126
|
+
{isActive && (
|
|
127
|
+
<motion.div
|
|
128
|
+
className="bg-primary dark:bg-accent absolute left-0 top-0 h-full w-full origin-left"
|
|
129
|
+
initial={{ scaleX: 0 }}
|
|
130
|
+
animate={{ scaleX: scrollProgress }}
|
|
131
|
+
transition={{ duration: 0.3, delay: 0.1 }}
|
|
132
|
+
/>
|
|
133
|
+
)}
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
)}
|
|
137
|
+
|
|
138
|
+
<Link
|
|
139
|
+
href={href}
|
|
140
|
+
onClick={() => handleLinkClick(id)}
|
|
141
|
+
className={clsx("relative flex items-center py-2 transition-colors", {
|
|
142
|
+
"text-primary dark:text-primary font-medium": isActive,
|
|
143
|
+
"text-muted-foreground hover:text-foreground dark:hover:text-foreground/90":
|
|
144
|
+
!isActive,
|
|
145
|
+
})}
|
|
146
|
+
style={{
|
|
147
|
+
paddingLeft: `${indent}px`,
|
|
148
|
+
marginLeft: level > 1 ? "12px" : "0",
|
|
149
|
+
}}
|
|
150
|
+
ref={(el) => {
|
|
151
|
+
const map = itemRefs.current
|
|
152
|
+
if (el) {
|
|
153
|
+
map.set(id, el)
|
|
154
|
+
} else {
|
|
155
|
+
map.delete(id)
|
|
156
|
+
}
|
|
157
|
+
}}
|
|
158
|
+
>
|
|
159
|
+
{/* Circle indicator */}
|
|
160
|
+
<div className="relative flex h-4 w-4 shrink-0 items-center justify-center">
|
|
161
|
+
<div
|
|
162
|
+
className={clsx(
|
|
163
|
+
"relative z-10 h-1.5 w-1.5 rounded-full transition-all duration-300",
|
|
164
|
+
{
|
|
165
|
+
"bg-primary dark:bg-primary/90 scale-100": isActive,
|
|
166
|
+
"bg-muted-foreground/30 dark:bg-muted-foreground/30 group-hover:bg-primary/50 dark:group-hover:bg-primary/50 scale-75 group-hover:scale-100":
|
|
167
|
+
!isActive,
|
|
168
|
+
}
|
|
169
|
+
)}
|
|
170
|
+
>
|
|
171
|
+
{isActive && (
|
|
172
|
+
<motion.div
|
|
173
|
+
className="bg-primary/20 dark:bg-primary/30 absolute inset-0 rounded-full"
|
|
174
|
+
initial={{ scale: 1 }}
|
|
175
|
+
animate={{ scale: 1.8 }}
|
|
176
|
+
transition={{
|
|
177
|
+
duration: 2,
|
|
178
|
+
repeat: Infinity,
|
|
179
|
+
repeatType: "reverse",
|
|
180
|
+
}}
|
|
181
|
+
/>
|
|
182
|
+
)}
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
|
|
186
|
+
<span className="truncate text-sm">{text}</span>
|
|
187
|
+
</Link>
|
|
188
|
+
</div>
|
|
189
|
+
)
|
|
190
|
+
})}
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
{/* Add scroll to top link at the bottom of TOC */}
|
|
194
|
+
<ScrollToTop className="mt-6" />
|
|
195
|
+
</div>
|
|
196
|
+
)
|
|
197
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Link from "next/link";
|
|
2
|
-
import { ModeToggle } from "@/components/
|
|
2
|
+
import { ModeToggle } from "@/components/ThemeToggle";
|
|
3
3
|
import docuData from "@/docu.json";
|
|
4
4
|
import * as LucideIcons from "lucide-react";
|
|
5
5
|
|
|
@@ -20,21 +20,25 @@ const docuConfig = docuData as {
|
|
|
20
20
|
footer: FooterConfig;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
interface FooterProps {
|
|
24
|
+
id?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function Footer({ id }: FooterProps) {
|
|
24
28
|
const { footer } = docuConfig;
|
|
25
29
|
return (
|
|
26
|
-
<footer className="w-full py-8 border-t bg-background">
|
|
30
|
+
<footer id={id} className="w-full py-8 border-t bg-background">
|
|
27
31
|
<div className="container flex flex-col lg:flex-row items-center justify-between text-sm">
|
|
28
32
|
<div className="flex flex-col items-center lg:items-start justify-start gap-4 w-full lg:w-3/5 text-center lg:text-left">
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
<p className="text-muted-foreground">
|
|
34
|
+
Copyright © {new Date().getFullYear()} {footer.copyright} - <MadeWith />
|
|
35
|
+
</p>
|
|
36
|
+
<div className="flex items-center justify-center lg:justify-start gap-6 mt-2 w-full">
|
|
37
|
+
<FooterButtons />
|
|
38
|
+
</div>
|
|
35
39
|
</div>
|
|
36
40
|
<div className="hidden lg:flex items-center justify-end lg:w-2/5">
|
|
37
|
-
|
|
41
|
+
<ModeToggle />
|
|
38
42
|
</div>
|
|
39
43
|
</div>
|
|
40
44
|
</footer>
|
|
@@ -79,9 +83,9 @@ export function MadeWith() {
|
|
|
79
83
|
<span className="text-muted-foreground">Made with </span>
|
|
80
84
|
<span className="text-primary">
|
|
81
85
|
<Link href="https://www.docubook.pro" target="_blank" rel="noopener noreferrer" className="underline underline-offset-2 text-muted-foreground">
|
|
82
|
-
|
|
86
|
+
DocuBook
|
|
83
87
|
</Link>
|
|
84
|
-
|
|
88
|
+
</span>
|
|
85
89
|
</>
|
|
86
90
|
);
|
|
87
91
|
}
|
|
@@ -1,101 +1,73 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from "@/components/
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { DialogTitle, DialogDescription } from "@/components/ui/dialog";
|
|
14
|
-
import { ScrollArea } from "@/components/ui/scroll-area";
|
|
15
|
-
import DocsMenu from "@/components/docs-menu";
|
|
16
|
-
import { ModeToggle } from "@/components/theme-toggle";
|
|
17
|
-
import ContextPopover from "@/components/context-popover";
|
|
2
|
+
import { Sheet, SheetClose, SheetContent, SheetHeader, SheetTrigger } from "@/components/ui/sheet"
|
|
3
|
+
import { Logo, NavMenu } from "@/components/navbar"
|
|
4
|
+
import { Button } from "@/components/ui/button"
|
|
5
|
+
import { PanelRight } from "lucide-react"
|
|
6
|
+
import { DialogTitle, DialogDescription } from "@/components/ui/dialog"
|
|
7
|
+
import { ScrollArea } from "@/components/ui/scroll-area"
|
|
8
|
+
import DocsMenu from "@/components/DocsMenu"
|
|
9
|
+
import { ModeToggle } from "@/components/ThemeToggle"
|
|
10
|
+
import ContextPopover from "@/components/ContextPopover"
|
|
11
|
+
import Search from "@/components/SearchBox"
|
|
12
|
+
import GitHubButton from "@/components/Github"
|
|
18
13
|
|
|
19
|
-
|
|
20
|
-
export function ToggleButton({
|
|
21
|
-
collapsed,
|
|
22
|
-
onToggle
|
|
23
|
-
}: {
|
|
24
|
-
collapsed: boolean,
|
|
25
|
-
onToggle: () => void
|
|
26
|
-
}) {
|
|
14
|
+
export function Leftbar() {
|
|
27
15
|
return (
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
onClick={onToggle}
|
|
34
|
-
>
|
|
35
|
-
{collapsed ? (
|
|
36
|
-
<PanelLeftOpen size={18} />
|
|
37
|
-
) : (
|
|
38
|
-
<PanelLeftClose size={18} />
|
|
39
|
-
)}
|
|
40
|
-
</Button>
|
|
41
|
-
</div>
|
|
42
|
-
)
|
|
43
|
-
}
|
|
16
|
+
<aside className="sticky top-0 hidden h-screen w-[280px] shrink-0 flex-col lg:flex">
|
|
17
|
+
{/* Logo */}
|
|
18
|
+
<div className="flex h-14 shrink-0 items-center px-5">
|
|
19
|
+
<Logo />
|
|
20
|
+
</div>
|
|
44
21
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
22
|
+
<div className="flex shrink-0 items-center gap-2 px-4 pb-4">
|
|
23
|
+
<Search />
|
|
24
|
+
</div>
|
|
48
25
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
{/* Scrollable Content */}
|
|
56
|
-
<ScrollArea className="flex-1 px-0.5 pb-4">
|
|
57
|
-
{!collapsed && (
|
|
58
|
-
<div className="space-y-2">
|
|
59
|
-
<ContextPopover />
|
|
60
|
-
<DocsMenu />
|
|
61
|
-
</div>
|
|
62
|
-
)}
|
|
26
|
+
{/* Scrollable Navigation */}
|
|
27
|
+
<ScrollArea className="flex-1 px-4">
|
|
28
|
+
<div className="space-y-2">
|
|
29
|
+
<ContextPopover />
|
|
30
|
+
<DocsMenu />
|
|
31
|
+
</div>
|
|
63
32
|
</ScrollArea>
|
|
33
|
+
|
|
34
|
+
{/* Bottom: Theme Toggle */}
|
|
35
|
+
<div className="flex px-4 py-3">
|
|
36
|
+
<ModeToggle />
|
|
37
|
+
</div>
|
|
64
38
|
</aside>
|
|
65
|
-
)
|
|
39
|
+
)
|
|
66
40
|
}
|
|
67
41
|
|
|
68
42
|
export function SheetLeftbar() {
|
|
69
43
|
return (
|
|
70
44
|
<Sheet>
|
|
71
45
|
<SheetTrigger asChild>
|
|
72
|
-
<Button variant="ghost" size="icon" className="max-
|
|
73
|
-
<
|
|
46
|
+
<Button variant="ghost" size="icon" className="hidden max-md:flex">
|
|
47
|
+
<PanelRight className="h-6 w-6 shrink-0 text-muted-foreground" />
|
|
74
48
|
</Button>
|
|
75
49
|
</SheetTrigger>
|
|
76
|
-
<SheetContent className="flex flex-col gap-4 px-0" side="
|
|
50
|
+
<SheetContent className="flex flex-col gap-4 px-0" side="right">
|
|
77
51
|
<DialogTitle className="sr-only">Navigation Menu</DialogTitle>
|
|
78
52
|
<DialogDescription className="sr-only">
|
|
79
53
|
Main navigation menu with links to different sections
|
|
80
54
|
</DialogDescription>
|
|
81
55
|
<SheetHeader>
|
|
82
|
-
<SheetClose className="px-
|
|
83
|
-
<
|
|
56
|
+
<SheetClose className="px-4" asChild>
|
|
57
|
+
<div className="flex items-center justify-between">
|
|
58
|
+
<GitHubButton />
|
|
59
|
+
<div className="mr-8">
|
|
60
|
+
<ModeToggle />
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
84
63
|
</SheetClose>
|
|
85
64
|
</SheetHeader>
|
|
86
65
|
<div className="flex flex-col gap-4 overflow-y-auto">
|
|
87
|
-
<div className="flex flex-col gap-2.5
|
|
88
|
-
<NavMenu
|
|
89
|
-
</div>
|
|
90
|
-
<div className="mx-2 px-5 space-y-2">
|
|
91
|
-
<ContextPopover />
|
|
92
|
-
<DocsMenu isSheet />
|
|
93
|
-
</div>
|
|
94
|
-
<div className="flex w-2/4 px-5">
|
|
95
|
-
<ModeToggle />
|
|
66
|
+
<div className="mx-2 mt-3 flex flex-col gap-2.5 px-5">
|
|
67
|
+
<NavMenu />
|
|
96
68
|
</div>
|
|
97
69
|
</div>
|
|
98
70
|
</SheetContent>
|
|
99
71
|
</Sheet>
|
|
100
|
-
)
|
|
72
|
+
)
|
|
101
73
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { ReactNode } from "react";
|
|
4
4
|
import clsx from "clsx";
|
|
5
|
-
import { AccordionGroupContext } from "@/
|
|
5
|
+
import { AccordionGroupContext } from "@/lib/accordion-context";
|
|
6
6
|
|
|
7
7
|
interface AccordionGroupProps {
|
|
8
8
|
children: ReactNode;
|
|
@@ -4,7 +4,7 @@ import { ReactNode, useState, useContext } from 'react';
|
|
|
4
4
|
import { ChevronRight } from 'lucide-react';
|
|
5
5
|
import * as Icons from "lucide-react";
|
|
6
6
|
import { cn } from '@/lib/utils';
|
|
7
|
-
import { AccordionGroupContext } from '@/
|
|
7
|
+
import { AccordionGroupContext } from '@/lib/accordion-context';
|
|
8
8
|
|
|
9
9
|
type AccordionProps = {
|
|
10
10
|
title: string;
|
|
@@ -42,12 +42,12 @@ const Accordion: React.FC<AccordionProps> = ({
|
|
|
42
42
|
>
|
|
43
43
|
<ChevronRight
|
|
44
44
|
className={cn(
|
|
45
|
-
"w-4 h-4 text-muted-foreground transition-transform duration-200
|
|
45
|
+
"w-4 h-4 text-muted-foreground transition-transform duration-200 shrink-0",
|
|
46
46
|
isOpen && "rotate-90"
|
|
47
47
|
)}
|
|
48
48
|
/>
|
|
49
|
-
{Icon && <Icon className="text-foreground w-4 h-4
|
|
50
|
-
<h3 className="font-medium text-base text-foreground
|
|
49
|
+
{Icon && <Icon className="text-foreground w-4 h-4 shrink-0" />}
|
|
50
|
+
<h3 className="font-medium text-base text-foreground m-0!">{title}</h3>
|
|
51
51
|
</button>
|
|
52
52
|
|
|
53
53
|
{isOpen && (
|
|
@@ -24,13 +24,13 @@ const Card: React.FC<CardProps> = ({ title, icon, href, horizontal, children, cl
|
|
|
24
24
|
"bg-card text-card-foreground border-border",
|
|
25
25
|
"hover:bg-accent/5 hover:border-accent/30",
|
|
26
26
|
"flex gap-2",
|
|
27
|
-
horizontal ? "flex-row items-
|
|
27
|
+
horizontal ? "flex-row items-start gap-1" : "flex-col space-y-1",
|
|
28
28
|
className
|
|
29
29
|
)}
|
|
30
30
|
>
|
|
31
|
-
{Icon && <Icon className="w-5 h-5 text-primary
|
|
32
|
-
<div className="flex-1 min-w-0
|
|
33
|
-
<
|
|
31
|
+
{Icon && <Icon className={clsx("w-5 h-5 text-primary shrink-0", horizontal && "mt-0.5")} />}
|
|
32
|
+
<div className="flex-1 min-w-0">
|
|
33
|
+
<div className="text-base font-semibold text-foreground leading-6">{title}</div>
|
|
34
34
|
<div className="text-sm text-muted-foreground -mt-3">{children}</div>
|
|
35
35
|
</div>
|
|
36
36
|
</div>
|