docs: fix divider in API reference + clean up layout (#10861)
* docs: fix divider in API reference + clean up layout * fix build error
This commit is contained in:
1 parent
54a3db79a1
commit
936954e0b4
13 files changed
+63
-56
No files matched your search
@@ -3,10 +3,8 @@ import AreaProvider from "@/providers/area"
|
|||||||
import AdminContent from "@/markdown/admin.mdx"
|
import AdminContent from "@/markdown/admin.mdx"
|
||||||
import Tags from "@/components/Tags"
|
import Tags from "@/components/Tags"
|
||||||
import PageTitleProvider from "@/providers/page-title"
|
import PageTitleProvider from "@/providers/page-title"
|
||||||
import { H1 } from "docs-ui"
|
|
||||||
import { getBaseSpecs } from "../../lib"
|
import { getBaseSpecs } from "../../lib"
|
||||||
import BaseSpecsProvider from "../../providers/base-specs"
|
import BaseSpecsProvider from "../../providers/base-specs"
|
||||||
import clsx from "clsx"
|
|
||||||
import React from "react"
|
import React from "react"
|
||||||
|
|
||||||
const AdminPage = async () => {
|
const AdminPage = async () => {
|
||||||
@@ -16,15 +14,6 @@ const AdminPage = async () => {
|
|||||||
<BaseSpecsProvider baseSpecs={data}>
|
<BaseSpecsProvider baseSpecs={data}>
|
||||||
<AreaProvider area={"admin"}>
|
<AreaProvider area={"admin"}>
|
||||||
<PageTitleProvider>
|
<PageTitleProvider>
|
||||||
<H1
|
|
||||||
className={clsx(
|
|
||||||
"!h2-docs lg:pl-4",
|
|
||||||
"scroll-m-[184px] lg:scroll-m-[264px]"
|
|
||||||
)}
|
|
||||||
id="introduction"
|
|
||||||
>
|
|
||||||
Medusa V2 Admin API Reference
|
|
||||||
</H1>
|
|
||||||
{/* @ts-ignore React v19 doesn't see MDX as valid component */}
|
{/* @ts-ignore React v19 doesn't see MDX as valid component */}
|
||||||
<AdminContent />
|
<AdminContent />
|
||||||
<Tags tags={data?.tags} />
|
<Tags tags={data?.tags} />
|
||||||
|
|||||||
@@ -3,10 +3,8 @@ import AreaProvider from "@/providers/area"
|
|||||||
import StoreContent from "@/markdown/store.mdx"
|
import StoreContent from "@/markdown/store.mdx"
|
||||||
import Tags from "@/components/Tags"
|
import Tags from "@/components/Tags"
|
||||||
import PageTitleProvider from "@/providers/page-title"
|
import PageTitleProvider from "@/providers/page-title"
|
||||||
import { H1 } from "docs-ui"
|
|
||||||
import { getBaseSpecs } from "../../lib"
|
import { getBaseSpecs } from "../../lib"
|
||||||
import BaseSpecsProvider from "../../providers/base-specs"
|
import BaseSpecsProvider from "../../providers/base-specs"
|
||||||
import clsx from "clsx"
|
|
||||||
|
|
||||||
const StorePage = async () => {
|
const StorePage = async () => {
|
||||||
const data = await getBaseSpecs("store")
|
const data = await getBaseSpecs("store")
|
||||||
@@ -15,15 +13,6 @@ const StorePage = async () => {
|
|||||||
<BaseSpecsProvider baseSpecs={data}>
|
<BaseSpecsProvider baseSpecs={data}>
|
||||||
<AreaProvider area={"store"}>
|
<AreaProvider area={"store"}>
|
||||||
<PageTitleProvider>
|
<PageTitleProvider>
|
||||||
<H1
|
|
||||||
className={clsx(
|
|
||||||
"!h2-docs lg:pl-4",
|
|
||||||
"scroll-m-[184px] lg:scroll-m-[264px]"
|
|
||||||
)}
|
|
||||||
id="introduction"
|
|
||||||
>
|
|
||||||
Medusa V2 Store API Reference
|
|
||||||
</H1>
|
|
||||||
{/* @ts-ignore React v19 doesn't see MDX as valid component */}
|
{/* @ts-ignore React v19 doesn't see MDX as valid component */}
|
||||||
<StoreContent />
|
<StoreContent />
|
||||||
<Tags tags={data?.tags} />
|
<Tags tags={data?.tags} />
|
||||||
|
|||||||
@@ -1,27 +1,31 @@
|
|||||||
import clsx from "clsx"
|
import clsx from "clsx"
|
||||||
import SectionDivider from "../Divider"
|
import SectionDivider from "../Divider"
|
||||||
import { forwardRef } from "react"
|
import { forwardRef } from "react"
|
||||||
|
import { WideSection } from "docs-ui"
|
||||||
|
|
||||||
type SectionContainerProps = {
|
type SectionContainerProps = {
|
||||||
children: React.ReactNode
|
children: React.ReactNode
|
||||||
noTopPadding?: boolean
|
noTopPadding?: boolean
|
||||||
noDivider?: boolean
|
noDivider?: boolean
|
||||||
|
className?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const SectionContainer = forwardRef<HTMLDivElement, SectionContainerProps>(
|
const SectionContainer = forwardRef<HTMLDivElement, SectionContainerProps>(
|
||||||
function SectionContainer(
|
function SectionContainer(
|
||||||
{ children, noTopPadding = false, noDivider = false },
|
{ children, noTopPadding = false, noDivider = false, className },
|
||||||
ref
|
ref
|
||||||
) {
|
) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={clsx("relative pb-4 md:pb-7", !noTopPadding && "pt-7")}
|
|
||||||
ref={ref}
|
ref={ref}
|
||||||
>
|
className={clsx(
|
||||||
{children}
|
"relative pb-4 md:pb-7",
|
||||||
{!noDivider && (
|
!noTopPadding && "pt-7",
|
||||||
<SectionDivider className="-left-[16px] lg:!-left-1/4" />
|
className
|
||||||
)}
|
)}
|
||||||
|
>
|
||||||
|
<WideSection>{children}</WideSection>
|
||||||
|
{!noDivider && <SectionDivider />}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,7 @@ type SectionDividerProps = {
|
|||||||
const SectionDivider = ({ className }: SectionDividerProps) => {
|
const SectionDivider = ({ className }: SectionDividerProps) => {
|
||||||
return (
|
return (
|
||||||
<hr
|
<hr
|
||||||
className={clsx(
|
className={clsx("absolute bottom-0 z-0 m-0 w-screen left-0", className)}
|
||||||
"absolute bottom-0 -left-1.5 z-0 m-0 w-screen lg:left-0",
|
|
||||||
className
|
|
||||||
)}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import dynamic from "next/dynamic"
|
|||||||
import TagsOperationDescriptionSectionParameters from "./Parameters"
|
import TagsOperationDescriptionSectionParameters from "./Parameters"
|
||||||
import MDXContentClient from "@/components/MDXContent/Client"
|
import MDXContentClient from "@/components/MDXContent/Client"
|
||||||
import { useArea } from "../../../../providers/area"
|
import { useArea } from "../../../../providers/area"
|
||||||
import { Feedback, Badge, Link, FeatureFlagNotice } from "docs-ui"
|
import { Feedback, Badge, Link, FeatureFlagNotice, H2 } from "docs-ui"
|
||||||
import { usePathname } from "next/navigation"
|
import { usePathname } from "next/navigation"
|
||||||
import { TagsOperationDescriptionSectionWorkflowBadgeProps } from "./WorkflowBadge"
|
import { TagsOperationDescriptionSectionWorkflowBadgeProps } from "./WorkflowBadge"
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ const TagsOperationDescriptionSection = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h2>
|
<H2>
|
||||||
{operation.summary}
|
{operation.summary}
|
||||||
{operation.deprecated && (
|
{operation.deprecated && (
|
||||||
<Badge variant="orange" className="ml-0.5">
|
<Badge variant="orange" className="ml-0.5">
|
||||||
@@ -57,7 +57,7 @@ const TagsOperationDescriptionSection = ({
|
|||||||
badgeClassName="ml-0.5"
|
badgeClassName="ml-0.5"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</h2>
|
</H2>
|
||||||
<div className="my-1">
|
<div className="my-1">
|
||||||
<MDXContentClient content={operation.description} />
|
<MDXContentClient content={operation.description} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ import TagsOperationDescriptionSection from "./DescriptionSection"
|
|||||||
import DividedLayout from "@/layouts/Divided"
|
import DividedLayout from "@/layouts/Divided"
|
||||||
import { useLoading } from "@/providers/loading"
|
import { useLoading } from "@/providers/loading"
|
||||||
import { useRouter } from "next/navigation"
|
import { useRouter } from "next/navigation"
|
||||||
import SectionDivider from "../../Section/Divider"
|
|
||||||
import checkElementInViewport from "../../../utils/check-element-in-viewport"
|
import checkElementInViewport from "../../../utils/check-element-in-viewport"
|
||||||
import DividedLoading from "../../DividedLoading"
|
import DividedLoading from "../../DividedLoading"
|
||||||
|
import SectionContainer from "../../Section/Container"
|
||||||
|
|
||||||
const TagOperationCodeSection = dynamic<TagOperationCodeSectionProps>(
|
const TagOperationCodeSection = dynamic<TagOperationCodeSectionProps>(
|
||||||
async () => import("./CodeSection")
|
async () => import("./CodeSection")
|
||||||
@@ -116,7 +116,7 @@ const TagOperation = ({
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<SectionContainer
|
||||||
ref={nodeRef}
|
ref={nodeRef}
|
||||||
className={clsx("relative min-h-screen w-full pb-7", className)}
|
className={clsx("relative min-h-screen w-full pb-7", className)}
|
||||||
>
|
>
|
||||||
@@ -144,8 +144,7 @@ const TagOperation = ({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<SectionDivider className="-left-[16px] lg:!-left-1/4" />
|
</SectionContainer>
|
||||||
</div>
|
|
||||||
</InView>
|
</InView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,18 +124,19 @@ const TagSectionSchema = ({ schema, tagName }: TagSectionSchemaProps) => {
|
|||||||
root={root}
|
root={root}
|
||||||
threshold={0.1}
|
threshold={0.1}
|
||||||
>
|
>
|
||||||
|
<SectionContainer ref={paramsRef}>
|
||||||
<DividedLayout
|
<DividedLayout
|
||||||
mainContent={
|
mainContent={
|
||||||
<SectionContainer ref={paramsRef}>
|
<div>
|
||||||
<h2>{formattedName} Object</h2>
|
<h2>{formattedName} Object</h2>
|
||||||
<h4 className="border-medusa-border-base border-b py-1.5 mt-2">
|
<h4 className="border-medusa-border-base border-b py-1.5 mt-2">
|
||||||
Fields
|
Fields
|
||||||
</h4>
|
</h4>
|
||||||
<TagOperationParameters schemaObject={schema} topLevel={true} />
|
<TagOperationParameters schemaObject={schema} topLevel={true} />
|
||||||
</SectionContainer>
|
</div>
|
||||||
}
|
}
|
||||||
codeContent={
|
codeContent={
|
||||||
<SectionContainer noDivider>
|
<>
|
||||||
{examples.length && (
|
{examples.length && (
|
||||||
<CodeBlock
|
<CodeBlock
|
||||||
source={examples[0].content}
|
source={examples[0].content}
|
||||||
@@ -147,9 +148,10 @@ const TagSectionSchema = ({ schema, tagName }: TagSectionSchemaProps) => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</SectionContainer>
|
</>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
</SectionContainer>
|
||||||
</InView>
|
</InView>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import getSectionId from "@/utils/get-section-id"
|
|||||||
import { InView } from "react-intersection-observer"
|
import { InView } from "react-intersection-observer"
|
||||||
import { useEffect, useMemo, useState } from "react"
|
import { useEffect, useMemo, useState } from "react"
|
||||||
import {
|
import {
|
||||||
|
H2,
|
||||||
isElmWindow,
|
isElmWindow,
|
||||||
swrFetcher,
|
swrFetcher,
|
||||||
useIsBrowser,
|
useIsBrowser,
|
||||||
@@ -135,10 +136,11 @@ const TagSectionComponent = ({ tag }: TagSectionProps) => {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<SectionContainer>
|
||||||
<DividedLayout
|
<DividedLayout
|
||||||
mainContent={
|
mainContent={
|
||||||
<SectionContainer noDivider={true}>
|
<div>
|
||||||
<h2>{tag.name}</h2>
|
<H2>{tag.name}</H2>
|
||||||
{tag.description && (
|
{tag.description && (
|
||||||
<Section>
|
<Section>
|
||||||
<MDXContentClient
|
<MDXContentClient
|
||||||
@@ -167,11 +169,11 @@ const TagSectionComponent = ({ tag }: TagSectionProps) => {
|
|||||||
vertical
|
vertical
|
||||||
question="Was this section helpful?"
|
question="Was this section helpful?"
|
||||||
/>
|
/>
|
||||||
<SectionDivider className="-left-[16px] lg:!-left-[30%]" />
|
</div>
|
||||||
</SectionContainer>
|
|
||||||
}
|
}
|
||||||
codeContent={<></>}
|
codeContent={<></>}
|
||||||
/>
|
/>
|
||||||
|
</SectionContainer>
|
||||||
{schemaData && (
|
{schemaData && (
|
||||||
<TagSectionSchema schema={schemaData.schema} tagName={tag.name} />
|
<TagSectionSchema schema={schemaData.schema} tagName={tag.name} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Feedback, CodeTabs, CodeTab } from "docs-ui"
|
import { Feedback, CodeTabs, CodeTab, H1 } from "docs-ui"
|
||||||
import SectionContainer from "@/components/Section/Container"
|
import SectionContainer from "@/components/Section/Container"
|
||||||
import DividedMarkdownLayout from "@/layouts/DividedMarkdown"
|
import DividedMarkdownLayout from "@/layouts/DividedMarkdown"
|
||||||
import {
|
import {
|
||||||
@@ -17,6 +17,8 @@ import ClientLibraries from "./client-libraries.mdx"
|
|||||||
|
|
||||||
<DividedMarkdownContent>
|
<DividedMarkdownContent>
|
||||||
|
|
||||||
|
<H1 className={"!h2-docs scroll-m-[184px] lg:scroll-m-[264px]"} id="introduction">Medusa V2 Admin API Reference</H1>
|
||||||
|
|
||||||
This API reference includes Medusa v2's Admin APIs, which are REST APIs exposed by the Medusa application. They are used to perform admin functionalities or create an admin dashboard to access and manipulate your commerce store's data.
|
This API reference includes Medusa v2's Admin APIs, which are REST APIs exposed by the Medusa application. They are used to perform admin functionalities or create an admin dashboard to access and manipulate your commerce store's data.
|
||||||
|
|
||||||
All API Routes are prefixed with `/admin`. So, during development, the API Routes will be available under the path `http://localhost:9000/admin`. For production, replace `http://localhost:9000` with your Medusa application URL.
|
All API Routes are prefixed with `/admin`. So, during development, the API Routes will be available under the path `http://localhost:9000/admin`. For production, replace `http://localhost:9000` with your Medusa application URL.
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
DividedMarkdownCode
|
DividedMarkdownCode
|
||||||
} from "@/layouts/DividedMarkdown/Sections"
|
} from "@/layouts/DividedMarkdown/Sections"
|
||||||
import Section from "@/components/Section"
|
import Section from "@/components/Section"
|
||||||
import { Feedback, CodeTabs, CodeTab } from "docs-ui"
|
import { Feedback, CodeTabs, CodeTab, H1 } from "docs-ui"
|
||||||
|
|
||||||
import ClientLibraries from "./client-libraries.mdx"
|
import ClientLibraries from "./client-libraries.mdx"
|
||||||
|
|
||||||
@@ -17,6 +17,8 @@ import ClientLibraries from "./client-libraries.mdx"
|
|||||||
|
|
||||||
<DividedMarkdownContent>
|
<DividedMarkdownContent>
|
||||||
|
|
||||||
|
<H1 className={"!h2-docs scroll-m-[184px] lg:scroll-m-[264px]"} id="introduction">Medusa V2 Store API Reference</H1>
|
||||||
|
|
||||||
This API reference includes Medusa v2's Store APIs, which are REST APIs exposed by the Medusa application. They are used to create a storefront for your commerce store, such as a webshop or a commerce mobile app.
|
This API reference includes Medusa v2's Store APIs, which are REST APIs exposed by the Medusa application. They are used to create a storefront for your commerce store, such as a webshop or a commerce mobile app.
|
||||||
|
|
||||||
All API Routes are prefixed with `/store`. So, during development, the API Routes will be available under the path `http://localhost:9000/store`. For production, replace `http://localhost:9000` with your Medusa application URL.
|
All API Routes are prefixed with `/store`. So, during development, the API Routes will be available under the path `http://localhost:9000/store`. For production, replace `http://localhost:9000` with your Medusa application URL.
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import React from "react"
|
||||||
|
import clsx from "clsx"
|
||||||
|
|
||||||
|
type WideSectionProps = React.AllHTMLAttributes<HTMLElement> & {
|
||||||
|
as?: "div" | "main"
|
||||||
|
}
|
||||||
|
|
||||||
|
export const WideSection = ({
|
||||||
|
children,
|
||||||
|
className,
|
||||||
|
as = "div",
|
||||||
|
}: WideSectionProps) => {
|
||||||
|
const Component = as
|
||||||
|
return (
|
||||||
|
<Component
|
||||||
|
className={clsx(
|
||||||
|
"max-w-inner-content-xs sm:max-w-inner-content-sm md:max-w-inner-content-md",
|
||||||
|
"lg:max-w-lg-wide-content xl:max-w-xl-wide-content px-1 lg:px-0 mx-auto",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</Component>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -74,5 +74,6 @@ export * from "./Toggle"
|
|||||||
export * from "./Tooltip"
|
export * from "./Tooltip"
|
||||||
export * from "./TypeList"
|
export * from "./TypeList"
|
||||||
export * from "./VerticalCodeTabs"
|
export * from "./VerticalCodeTabs"
|
||||||
|
export * from "./WideSection"
|
||||||
export * from "./WorkflowDiagram"
|
export * from "./WorkflowDiagram"
|
||||||
export * from "./ZoomImg"
|
export * from "./ZoomImg"
|
||||||
@@ -15,14 +15,9 @@ export const WideLayout = ({
|
|||||||
<RootLayout
|
<RootLayout
|
||||||
{...props}
|
{...props}
|
||||||
mainWrapperClasses={clsx(props.mainWrapperClasses, "mx-auto flex")}
|
mainWrapperClasses={clsx(props.mainWrapperClasses, "mx-auto flex")}
|
||||||
contentClassName="w-full px-1"
|
contentClassName="w-full"
|
||||||
>
|
|
||||||
<main
|
|
||||||
className={clsx(
|
|
||||||
"max-w-inner-content-xs sm:max-w-inner-content-sm md:max-w-inner-content-md",
|
|
||||||
"lg:max-w-lg-wide-content xl:max-w-xl-wide-content relative mt-4 w-full flex-1 lg:mt-7"
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
|
<main className={clsx("relative mt-4 w-full flex-1 lg:mt-7")}>
|
||||||
{showBreadcrumbs && <Breadcrumbs />}
|
{showBreadcrumbs && <Breadcrumbs />}
|
||||||
{children}
|
{children}
|
||||||
{feedbackComponent}
|
{feedbackComponent}
|
||||||
|
|||||||
Reference in new issue
Block a user