Skip to content

Commit

Permalink
Add direct references to the nextjs docs sections
Browse files Browse the repository at this point in the history
  • Loading branch information
bcbogdan committed Sep 6, 2024
1 parent 79dd7d0 commit 9d58f81
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
13 changes: 11 additions & 2 deletions v2/community/reusableMD/supported-tech-stacks-frontend.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

import RecipeLink from "/src/components/RecipeLink";

<div style={{
display: "flex",
flexDirection: "row",
Expand All @@ -14,5 +17,11 @@
</div>

:::important for mobile apps
For mobile apps, please see the "Using your own UI" section (see left nav bar)
:::
For mobile apps, please see the <RecipeLink link="custom-ui/init/frontend">**Using your own UI**</RecipeLink> section from the left nav bar
:::

:::important for nextjs
For **NextJS** apps, please go to the **Integrations** section from the left nav bar.
- <RecipeLink link="nextjs/app-directory/about"> App Directory Instructions </RecipeLink>
- <RecipeLink link="nextjs/about"> Pages Directory Instructions </RecipeLink>
:::
20 changes: 20 additions & 0 deletions v2/src/components/RecipeLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React, { useMemo } from "react";
import { useLocation } from "@docusaurus/router";

export default function RecipeLink({
link,
children,
}: React.PropsWithChildren<{ link: string }>) {
const { pathname } = useLocation();

const fullLink = useMemo(() => {
const [, , recipePath] = pathname.split("/");

console.log(link);

console.log(recipePath);
return `/docs/${recipePath}/${link}`;
}, [pathname, link]);

return <a href={fullLink}>{children}</a>;
}

0 comments on commit 9d58f81

Please sign in to comment.