chore: reorganize docs apps (#7228)

* reorganize docs apps

* add README

* fix directory

* add condition for old docs
This commit is contained in:
Shahed Nasser authored and GitHub committed 2024-05-03 17:36:38 +03:00
1 parent 224ebb2154
commit 4fe28f5a95
6187 files changed
+601447 -598226

No files matched your search

@@ -0,0 +1,16 @@
"use client"
import { EditButton as UiEditButton } from "docs-ui"
import { usePathname } from "next/navigation"
const EditButton = () => {
const pathname = usePathname()
return (
<UiEditButton
filePath={`/www/apps/book/app${pathname.replace(/\/$/, "")}/page.mdx`}
/>
)
}
export default EditButton
@@ -0,0 +1,30 @@
"use client"
import {
Feedback as UiFeedback,
FeedbackProps as UiFeedbackProps,
formatReportLink,
} from "docs-ui"
import { usePathname } from "next/navigation"
import { config } from "../../config"
type FeedbackProps = Omit<UiFeedbackProps, "event" | "pathName">
const Feedback = (props: FeedbackProps) => {
const pathname = usePathname()
return (
<UiFeedback
event="survey"
pathName={pathname}
reportLink={formatReportLink(
config.titleSuffix || "",
typeof document !== "undefined" ? document.title : ""
)}
question="Was this chapter helpful?"
{...props}
/>
)
}
export default Feedback
@@ -0,0 +1,9 @@
import type { MDXComponents as MDXComponentsType } from "mdx/types"
import { Link, MDXComponents as UiMdxComponents } from "docs-ui"
const MDXComponents: MDXComponentsType = {
...UiMdxComponents,
a: Link,
}
export default MDXComponents
@@ -0,0 +1,12 @@
import { MDXRemote } from "next-mdx-remote/rsc"
import MDXComponents from "../MDXComponents"
type MDXContentProps = {
children: string
}
const MDXContent = ({ children }: MDXContentProps) => {
return <MDXRemote source={children} components={MDXComponents} />
}
export default MDXContent
+36
View File
@@ -0,0 +1,36 @@
"use client"
import { Navbar as UiNavbar, getNavbarItems } from "docs-ui"
import { useSidebar } from "docs-ui"
import { useMemo } from "react"
import { config } from "../../config"
const Navbar = () => {
const { setMobileSidebarOpen, mobileSidebarOpen } = useSidebar()
const navbarItems = useMemo(
() =>
getNavbarItems({
basePath: config.baseUrl,
activePath: "/",
}),
[]
)
return (
<UiNavbar
logo={{
light: "/images/logo-icon.png",
dark: "/images/logo-icon-dark.png",
}}
items={navbarItems}
mobileMenuButton={{
setMobileSidebarOpen,
mobileSidebarOpen,
}}
isLoading={false}
/>
)
}
export default Navbar