Skip to content

Commit

Permalink
docs: add routing page (medusajs#9550)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
shahednasser authored and 420coupe committed Oct 18, 2024
1 parent fe445a8 commit 7eb1b55
Show file tree
Hide file tree
Showing 223 changed files with 2,549 additions and 696 deletions.
27 changes: 14 additions & 13 deletions www/apps/api-reference/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "./globals.css"
import Providers from "../providers"
import { WideLayout } from "docs-ui"
import { BareboneLayout, WideLayout } from "docs-ui"
import { Inter, Roboto_Mono } from "next/font/google"
import clsx from "clsx"

Expand All @@ -26,17 +26,18 @@ export default function RootLayout({
children: React.ReactNode
}) {
return (
<WideLayout
ProvidersComponent={Providers}
sidebarProps={{
expandItems: false,
}}
bodyClassName={clsx(inter.variable, robotoMono.variable)}
showToc={false}
showBanner={false}
showBreadcrumbs={false}
>
{children}
</WideLayout>
<BareboneLayout htmlClassName={clsx(inter.variable, robotoMono.variable)}>
<WideLayout
sidebarProps={{
expandItems: false,
}}
showToc={false}
showBanner={false}
showBreadcrumbs={false}
ProvidersComponent={Providers}
>
{children}
</WideLayout>
</BareboneLayout>
)
}
6 changes: 1 addition & 5 deletions www/apps/api-reference/components/DownloadFull/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ const DownloadFull = () => {

return (
<Button variant="secondary">
<Link
href={`${process.env.NEXT_PUBLIC_BASE_PATH}/download/${area}`}
download
target="_blank"
>
<Link href={`/api/download/${area}`} download target="_blank">
Download OpenApi Specs Collection
</Link>
</Button>
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions www/apps/book/app/fonts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Inter, Roboto_Mono } from "next/font/google"

export const inter = Inter({
subsets: ["latin"],
variable: "--font-inter",
weight: ["400", "500"],
})

export const robotoMono = Roboto_Mono({
subsets: ["latin"],
variable: "--font-roboto-mono",
})
6 changes: 5 additions & 1 deletion www/apps/book/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
@apply bg-medusa-bg-highlight;
}

* {
*:not(.code-block-elm) {
scrollbar-color: var(--docs-border-base) var(--docs-bg-base);
}

.code-block-elm {
scrollbar-color: var(--docs-contrast-border-base) transparent;
}

aside * {
scrollbar-color: var(--docs-border-base) var(--docs-bg-subtle);
}
Expand Down
31 changes: 4 additions & 27 deletions www/apps/book/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import type { Metadata } from "next"
import { Inter, Roboto_Mono } from "next/font/google"
import Providers from "@/providers"
import "./globals.css"
import { TightLayout } from "docs-ui"
import { config } from "@/config"
import { BareboneLayout } from "docs-ui"
import { inter, robotoMono } from "./fonts"
import clsx from "clsx"
import Feedback from "@/components/Feedback"
import EditButton from "@/components/EditButton"

export const metadata: Metadata = {
title: {
Expand All @@ -19,34 +16,14 @@ export const metadata: Metadata = {
),
}

export const inter = Inter({
subsets: ["latin"],
variable: "--font-inter",
weight: ["400", "500"],
})

export const robotoMono = Roboto_Mono({
subsets: ["latin"],
variable: "--font-roboto-mono",
})

export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<TightLayout
ProvidersComponent={Providers}
sidebarProps={{
expandItems: true,
}}
showPagination={true}
bodyClassName={clsx(inter.variable, robotoMono.variable)}
feedbackComponent={<Feedback className="my-2" />}
editComponent={<EditButton />}
>
<BareboneLayout htmlClassName={clsx(inter.variable, robotoMono.variable)}>
{children}
</TightLayout>
</BareboneLayout>
)
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions www/apps/book/app/learn/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { TightLayout } from "docs-ui"
import Feedback from "@/components/Feedback"
import EditButton from "@/components/EditButton"
import Providers from "../../providers"

export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<TightLayout
sidebarProps={{
expandItems: true,
}}
showPagination={true}
feedbackComponent={<Feedback className="my-2" />}
editComponent={<EditButton />}
ProvidersComponent={Providers}
>
{children}
</TightLayout>
)
}
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions www/apps/book/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { TightLayout } from "docs-ui"
import Feedback from "../components/Feedback"
import EditButton from "../components/EditButton"
import NotFoundContent from "./_not-found.mdx"
import Providers from "../providers"

const NotFoundPage = () => {
return (
<TightLayout
sidebarProps={{
expandItems: true,
}}
showPagination={true}
feedbackComponent={<Feedback className="my-2" />}
editComponent={<EditButton />}
ProvidersComponent={Providers}
>
<NotFoundContent />
</TightLayout>
)
}

export default NotFoundPage
49 changes: 49 additions & 0 deletions www/apps/book/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import clsx from "clsx"
import { MainNav, RootProviders } from "docs-ui"
import HomepageTopSection from "../components/Homepage/TopSection"
import Providers from "../providers"
import HomepageLinksSection from "../components/Homepage/LinksSection"
import HomepageRecipesSection from "../components/Homepage/RecipesSection"
import HomepageModulesSection from "../components/Homepage/ModulesSection"
import HomepageFooter from "../components/Homepage/Footer"

const Homepage = () => {
return (
<body
className={clsx(
"bg-medusa-bg-subtle font-base text-medium w-full",
"text-medusa-fg-subtle px-0.25 pt-0.25",
"h-screen overflow-hidden"
)}
>
<RootProviders>
<Providers>
<div
className={clsx(
"rounded-t bg-medusa-bg-base",
"shadow-elevation-card-rest dark:shadow-elevation-card-rest-dark",
"h-full w-full",
"overflow-y-scroll overflow-x-hidden"
)}
id="main"
>
<MainNav
className="border-b border-medusa-border-base"
itemsClassName={clsx(
"!my-1 [&_li_div]:!text-medusa-fg-subtle [&_li_a]:!text-medusa-fg-subtle",
"hover:[&_li_div]:!text-medusa-fg-base hover:[&_li_a]:!text-medusa-fg-base"
)}
/>
<HomepageTopSection />
<HomepageLinksSection />
<HomepageRecipesSection />
<HomepageModulesSection />
<HomepageFooter />
</div>
</Providers>
</RootProviders>
</body>
)
}

export default Homepage
Loading

0 comments on commit 7eb1b55

Please sign in to comment.