docs: add routing page (#9550)
- Add a new homepage to `book` project for the routing page - Move all main doc pages to be under `/v2/learn` (and added redirects + fixed links across docs) - Other: add admin components to resources dropdown + fixes to search on mobile. Closes DX-955 Preview: https://docs-v2-git-docs-router-page-medusajs.vercel.app/v2
This commit is contained in:
@@ -2,6 +2,7 @@ import React from "react"
|
||||
import NextLink from "next/link"
|
||||
import type { LinkProps as NextLinkProps } from "next/link"
|
||||
import clsx from "clsx"
|
||||
import { TriangleRightMini } from "@medusajs/icons"
|
||||
|
||||
export type LinkProps = {
|
||||
href?: string
|
||||
@@ -9,9 +10,16 @@ export type LinkProps = {
|
||||
className?: string
|
||||
target?: string
|
||||
rel?: string
|
||||
withIcon?: boolean
|
||||
} & Partial<NextLinkProps>
|
||||
|
||||
export const Link = ({ href, children, className, ...rest }: LinkProps) => {
|
||||
export const Link = ({
|
||||
href,
|
||||
children,
|
||||
className,
|
||||
withIcon = false,
|
||||
...rest
|
||||
}: LinkProps) => {
|
||||
if (href?.replace(/#.*$/, "").endsWith("page.mdx")) {
|
||||
href = href.replace("/page.mdx", "")
|
||||
}
|
||||
@@ -21,10 +29,14 @@ export const Link = ({ href, children, className, ...rest }: LinkProps) => {
|
||||
{...rest}
|
||||
className={clsx(
|
||||
"text-medusa-fg-interactive hover:text-medusa-fg-interactive-hover",
|
||||
withIcon && "flex gap-0.25 items-center group",
|
||||
className
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
{withIcon && (
|
||||
<TriangleRightMini className="group-hover:translate-x-docs_0.125 transition-transform" />
|
||||
)}
|
||||
</NextLink>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user