docs: added cloud documentation project (#12711)
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
"use client"
|
||||
|
||||
import { EditButton as UiEditButton } from "docs-ui"
|
||||
import { usePathname } from "next/navigation"
|
||||
import { useCallback, useEffect, useState } from "react"
|
||||
|
||||
const EditButton = () => {
|
||||
const pathname = usePathname()
|
||||
const [editDate, setEditDate] = useState<string | undefined>()
|
||||
|
||||
const loadEditDate = useCallback(async () => {
|
||||
const generatedEditDates = (await import("../../generated/edit-dates.mjs"))
|
||||
.generatedEditDates
|
||||
setEditDate(
|
||||
(generatedEditDates as Record<string, string>)[
|
||||
`app${pathname.replace(/\/$/, "")}/page.mdx`
|
||||
]
|
||||
)
|
||||
}, [pathname])
|
||||
|
||||
useEffect(() => {
|
||||
void loadEditDate()
|
||||
}, [loadEditDate])
|
||||
|
||||
if (!editDate) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
return (
|
||||
<UiEditButton
|
||||
filePath={`/www/apps/cloud/app${pathname.replace(/\/$/, "")}/page.mdx`}
|
||||
editDate={editDate}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default EditButton
|
||||
@@ -0,0 +1,28 @@
|
||||
"use client"
|
||||
|
||||
import {
|
||||
Feedback as UiFeedback,
|
||||
FeedbackProps as UiFeedbackProps,
|
||||
} from "docs-ui"
|
||||
import { usePathname } from "next/navigation"
|
||||
import { basePathUrl } from "../../utils/base-path-url"
|
||||
import { useMemo } from "react"
|
||||
|
||||
type FeedbackProps = Omit<UiFeedbackProps, "event" | "pathName">
|
||||
|
||||
const Feedback = (props: FeedbackProps) => {
|
||||
const pathname = usePathname()
|
||||
|
||||
const feedbackPathname = useMemo(() => basePathUrl(pathname), [pathname])
|
||||
|
||||
return (
|
||||
<UiFeedback
|
||||
event="survey"
|
||||
pathName={feedbackPathname}
|
||||
question="Was this guide helpful?"
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default Feedback
|
||||
@@ -0,0 +1,17 @@
|
||||
"use client"
|
||||
|
||||
import { Footer as UiFooter } from "docs-ui"
|
||||
import Feedback from "../Feedback"
|
||||
import EditButton from "../EditButton"
|
||||
|
||||
const Footer = () => {
|
||||
return (
|
||||
<UiFooter
|
||||
showPagination={true}
|
||||
feedbackComponent={<Feedback className="my-2" />}
|
||||
editComponent={<EditButton />}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default Footer
|
||||
@@ -0,0 +1,16 @@
|
||||
import type { MDXComponents as MDXComponentsType } from "mdx/types"
|
||||
import {
|
||||
Link,
|
||||
MDXComponents as UiMdxComponents,
|
||||
InlineThemeImage,
|
||||
InlineIcon,
|
||||
} from "docs-ui"
|
||||
|
||||
const MDXComponents: MDXComponentsType = {
|
||||
...UiMdxComponents,
|
||||
a: Link,
|
||||
InlineThemeImage,
|
||||
InlineIcon,
|
||||
}
|
||||
|
||||
export default MDXComponents
|
||||
Reference in New Issue
Block a user