Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: revise storefront development guide #10522

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions www/apps/resources/app/storefront-development/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,18 @@ export const metadata = {

# {metadata.title}

This section of the documentation holds guides to help you build a storefront for your Medusa application.
The Medusa application is made up of a Node.js service and an admin dashboard. The storefront is installed, built, and hosted separately from the Medusa application, providing you with the flexibility to choose the frontend tech stack that you and your team are proficient in, and implement unique design systems and user experience.

<ChildDocs onlyTopLevel={true} showItems={["Tips", "Publishable API Key"]} />
<Note>

<ChildDocs hideItems={["Tips", "Publishable API Key"]} />
Learn more about Medusa's architecture in [this documentation](!docs!/learn/introduction/architecture).

</Note>

You can build your storefront from scratch, or built it on top of the [Next.js Starter storefront](../nextjs-starter/page.mdx). This section of the documentation provides guides to help you build a storefront from scratch for your Medusa application.

<ChildDocs showItems={["General"]} />

---

<ChildDocs hideItems={["General"]} />
2 changes: 1 addition & 1 deletion www/apps/resources/generated/edit-dates.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export const generatedEditDates = {
"app/storefront-development/regions/store-retrieve-region/page.mdx": "2024-09-11T10:07:42.887Z",
"app/storefront-development/regions/page.mdx": "2024-06-09T15:19:09+02:00",
"app/storefront-development/tips/page.mdx": "2024-10-22T11:01:01.298Z",
"app/storefront-development/page.mdx": "2024-06-09T15:19:09+02:00",
"app/storefront-development/page.mdx": "2024-12-10T09:23:20.666Z",
"app/troubleshooting/cors-errors/page.mdx": "2024-05-03T17:36:38+03:00",
"app/troubleshooting/create-medusa-app-errors/page.mdx": "2024-07-11T10:29:13+03:00",
"app/troubleshooting/database-errors/page.mdx": "2024-05-03T17:36:38+03:00",
Expand Down
35 changes: 20 additions & 15 deletions www/apps/resources/generated/sidebar.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8092,21 +8092,26 @@ export const generatedSidebar = [
{
"loaded": true,
"isPathHref": true,
"type": "link",
"path": "/storefront-development/tips",
"title": "Tips",
"children": []
},
{
"loaded": true,
"isPathHref": true,
"type": "link",
"path": "/storefront-development/publishable-api-keys",
"title": "Publishable API Key",
"children": []
},
{
"type": "separator"
"type": "category",
"title": "General",
"children": [
{
"loaded": true,
"isPathHref": true,
"type": "link",
"path": "/storefront-development/tips",
"title": "Tips",
"children": []
},
{
"loaded": true,
"isPathHref": true,
"type": "link",
"path": "/storefront-development/publishable-api-keys",
"title": "Publishable API Key",
"children": []
}
]
},
{
"loaded": true,
Expand Down
25 changes: 14 additions & 11 deletions www/apps/resources/sidebar.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1818,17 +1818,20 @@ export const sidebar = sidebarAttachHrefCommonOptions([
isChildSidebar: true,
children: [
{
type: "link",
path: "/storefront-development/tips",
title: "Tips",
},
{
type: "link",
path: "/storefront-development/publishable-api-keys",
title: "Publishable API Key",
},
{
type: "separator",
type: "category",
title: "General",
children: [
{
type: "link",
path: "/storefront-development/tips",
title: "Tips",
},
{
type: "link",
path: "/storefront-development/publishable-api-keys",
title: "Publishable API Key",
},
],
},
{
type: "category",
Expand Down
10 changes: 8 additions & 2 deletions www/packages/docs-ui/src/components/ChildDocs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import React, { useMemo } from "react"
import { Card, CardList, H2, useSidebar } from "../.."
import { InteractiveSidebarItem, SidebarItem, SidebarItemLink } from "types"
import slugify from "slugify"
import { MDXComponents } from "../.."

const Hr = MDXComponents["hr"] as () => React.JSX.Element

type ChildDocsProps = {
onlyTopLevel?: boolean
Expand Down Expand Up @@ -148,8 +151,9 @@ export const ChildDocs = ({
)
}

const getAllLevelsElms = (items?: SidebarItem[]) =>
filterNonInteractiveItems(items).map((item, key) => {
const getAllLevelsElms = (items?: SidebarItem[]) => {
const filteredItems = filterNonInteractiveItems(items)
return filteredItems.map((item, key) => {
const itemChildren = getChildrenForLevel(item)
const HeadingComponent = itemChildren?.length ? H2 : undefined

Expand All @@ -170,6 +174,7 @@ export const ChildDocs = ({
})) || []
}
/>
{key !== filteredItems.length - 1 && <Hr />}
</>
)}
{!HeadingComponent && item.type === "link" && (
Expand All @@ -178,6 +183,7 @@ export const ChildDocs = ({
</React.Fragment>
)
})
}

const getElms = (items?: SidebarItem[]) => {
return onlyTopLevel ? getTopLevelElms(items) : getAllLevelsElms(items)
Expand Down
Loading