@@ -12,6 +16,7 @@ const Layout = ({ children }) => {
{children}
+ {router.pathname !== "/" && }
diff --git a/src/components/Common/editOnGitHubLink.jsx b/src/components/Common/editOnGitHubLink.jsx new file mode 100644 index 00000000..f5f09a1f --- /dev/null +++ b/src/components/Common/editOnGitHubLink.jsx @@ -0,0 +1,29 @@ +// components/EditOnGitHubLink.jsx +import { useRouter } from "next/router"; +import { GoPencil } from "react-icons/go"; + +const EditOnGitHubLink = () => { + const router = useRouter(); + const path = router.asPath.replace(/\/$/, ""); + const githubUrl = `https://github.com/liara-cloud/docs/blob/master/src/pages${path}.mdx`; + + return ( +
+ ); +}; + +export default EditOnGitHubLink; diff --git a/src/components/Layout/index.jsx b/src/components/Layout/index.jsx index 7d604428..c9fd881c 100644 --- a/src/components/Layout/index.jsx +++ b/src/components/Layout/index.jsx @@ -1,10 +1,14 @@ import React, { useState } from "react"; import Header from "@/components/Header"; import Sidebar from "@/components/Sidebar"; +import EditOnGitHubLink from "@/components/Common/editOnGitHubLink"; +import { useRouter } from "next/router"; const Layout = ({ children }) => { const [showSidebar, setShowSidebar] = useState(false); - + + const router = useRouter(); + return (