docs: move edit date to footer (#11667)
* docs: move edit date to footer * fix build error
This commit is contained in:
1 parent
228b7b608d
commit
bf67f69f45
23 files changed
+183
-121
No files matched your search
@@ -4,6 +4,7 @@ import { usePathname } from "next/navigation"
|
||||
import { useMemo } from "react"
|
||||
import { EditButton as UiEditButton } from "docs-ui"
|
||||
import { filesMap } from "../../generated/files-map.mjs"
|
||||
import { generatedEditDates } from "../../generated/edit-dates.mjs"
|
||||
|
||||
const EditButton = () => {
|
||||
const pathname = usePathname()
|
||||
@@ -12,11 +13,19 @@ const EditButton = () => {
|
||||
[pathname]
|
||||
)
|
||||
|
||||
const editDate = useMemo(
|
||||
() =>
|
||||
(generatedEditDates as Record<string, string>)[
|
||||
`app${pathname.replace(/\/$/, "")}/page.mdx`
|
||||
],
|
||||
[pathname]
|
||||
)
|
||||
|
||||
if (!filePath) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
return <UiEditButton filePath={filePath.filePath} />
|
||||
return <UiEditButton filePath={filePath.filePath} editDate={editDate} />
|
||||
}
|
||||
|
||||
export default EditButton
|
||||
@@ -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={false}
|
||||
feedbackComponent={<Feedback className="my-2" />}
|
||||
editComponent={<EditButton />}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default Footer
|
||||
Reference in new issue
Block a user