docs: fix download button + other fixes (#8032)
- Fix text of download button - Small fix to styling on small devies - Fix mobile sidebar items using incorrect base url
This commit is contained in:
1 parent
b6fd82e31e
commit
4c89f91caf
13 files changed
+100
-46
No files matched your search
@@ -22,7 +22,11 @@ const ReferencePage = async () => {
|
|||||||
<AdminContentV2 />
|
<AdminContentV2 />
|
||||||
</Section>
|
</Section>
|
||||||
}
|
}
|
||||||
codeContent={<ClientLibrariesV2 />}
|
codeContent={
|
||||||
|
<div className="mb-1 lg:mb-0">
|
||||||
|
<ClientLibrariesV2 />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
className="flex-col-reverse"
|
className="flex-col-reverse"
|
||||||
/>
|
/>
|
||||||
<Tags />
|
<Tags />
|
||||||
|
|||||||
@@ -22,7 +22,11 @@ const ReferencePage = async () => {
|
|||||||
<StoreContentV2 />
|
<StoreContentV2 />
|
||||||
</Section>
|
</Section>
|
||||||
}
|
}
|
||||||
codeContent={<ClientLibrariesV2 />}
|
codeContent={
|
||||||
|
<div className="mb-1 lg:mb-0">
|
||||||
|
<ClientLibrariesV2 />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
className="flex-col-reverse"
|
className="flex-col-reverse"
|
||||||
/>
|
/>
|
||||||
<Tags />
|
<Tags />
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const DownloadFull = () => {
|
|||||||
download
|
download
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
Download openapi.yaml
|
Download OpenApi Specs Collection
|
||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import { DocsConfig } from "types"
|
import { DocsConfig } from "types"
|
||||||
import { mobileSidebarItemsV2 } from "docs-ui"
|
import { getMobileSidebarItems } from "docs-ui"
|
||||||
|
|
||||||
|
const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000"
|
||||||
|
|
||||||
export const config: DocsConfig = {
|
export const config: DocsConfig = {
|
||||||
baseUrl: process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000",
|
baseUrl,
|
||||||
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
|
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
|
||||||
// sidebar is auto generated
|
// sidebar is auto generated
|
||||||
sidebar: {
|
sidebar: {
|
||||||
@@ -14,6 +16,9 @@ export const config: DocsConfig = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
bottom: [],
|
bottom: [],
|
||||||
mobile: mobileSidebarItemsV2,
|
mobile: getMobileSidebarItems({
|
||||||
|
baseUrl,
|
||||||
|
version: "v2",
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,7 @@ const Navbar = () => {
|
|||||||
() =>
|
() =>
|
||||||
getNavbarItems({
|
getNavbarItems({
|
||||||
basePath: config.baseUrl,
|
basePath: config.baseUrl,
|
||||||
activePath: basePathUrl(""),
|
activePath: basePathUrl(),
|
||||||
version: "v2",
|
version: "v2",
|
||||||
}),
|
}),
|
||||||
[]
|
[]
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import { DocsConfig } from "types"
|
import { DocsConfig } from "types"
|
||||||
import { sidebarConfig } from "./sidebar"
|
import { sidebarConfig } from "./sidebar"
|
||||||
|
|
||||||
|
const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000"
|
||||||
|
|
||||||
export const config: DocsConfig = {
|
export const config: DocsConfig = {
|
||||||
titleSuffix: "Medusa v2 Docs",
|
titleSuffix: "Medusa v2 Docs",
|
||||||
baseUrl: process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000",
|
baseUrl,
|
||||||
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
|
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
|
||||||
sidebar: sidebarConfig,
|
sidebar: sidebarConfig(baseUrl),
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Badge, mobileSidebarItemsV2 } from "docs-ui"
|
import { Badge, getMobileSidebarItems } from "docs-ui"
|
||||||
import type { SidebarConfig, SidebarItemType } from "@/types"
|
import type { SidebarConfig, SidebarItemType } from "@/types"
|
||||||
import { sidebar } from "../sidebar.mjs"
|
import { sidebar } from "../sidebar.mjs"
|
||||||
|
|
||||||
@@ -17,8 +17,13 @@ const normalizeSidebarItems = (items: SidebarItemType[]) =>
|
|||||||
return item
|
return item
|
||||||
})
|
})
|
||||||
|
|
||||||
export const sidebarConfig: SidebarConfig = {
|
export const sidebarConfig = (baseUrl: string): SidebarConfig => {
|
||||||
top: normalizeSidebarItems(sidebar),
|
return {
|
||||||
bottom: [],
|
top: normalizeSidebarItems(sidebar),
|
||||||
mobile: mobileSidebarItemsV2,
|
bottom: [],
|
||||||
|
mobile: getMobileSidebarItems({
|
||||||
|
baseUrl,
|
||||||
|
version: "v2",
|
||||||
|
}),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,19 @@
|
|||||||
import { DocsConfig } from "types"
|
import { DocsConfig } from "types"
|
||||||
import { mobileSidebarItemsV2 } from "docs-ui"
|
import { getMobileSidebarItems } from "docs-ui"
|
||||||
import { generatedSidebar } from "../generated/sidebar.mjs"
|
import { generatedSidebar } from "../generated/sidebar.mjs"
|
||||||
|
|
||||||
|
const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000"
|
||||||
|
|
||||||
export const config: DocsConfig = {
|
export const config: DocsConfig = {
|
||||||
titleSuffix: "Medusa Learning Resources",
|
titleSuffix: "Medusa Learning Resources",
|
||||||
baseUrl: process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000",
|
baseUrl,
|
||||||
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
|
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
|
||||||
sidebar: {
|
sidebar: {
|
||||||
top: generatedSidebar,
|
top: generatedSidebar,
|
||||||
bottom: [],
|
bottom: [],
|
||||||
mobile: mobileSidebarItemsV2,
|
mobile: getMobileSidebarItems({
|
||||||
|
baseUrl,
|
||||||
|
version: "v2",
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ArrowUpRightOnBox } from "@medusajs/icons"
|
import { ArrowUpRightOnBox } from "@medusajs/icons"
|
||||||
import { NavbarItem, getNavbarItems, mobileSidebarItemsV1 } from "docs-ui"
|
import { NavbarItem, getMobileSidebarItems, getNavbarItems } from "docs-ui"
|
||||||
import { SidebarSectionItemsType } from "types"
|
import { SidebarSectionItemsType } from "types"
|
||||||
import { siteConfig } from "./site"
|
import { siteConfig } from "./site"
|
||||||
|
|
||||||
@@ -280,6 +280,9 @@ export const docsConfig: DocsConfig = {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
mobile: mobileSidebarItemsV1,
|
mobile: getMobileSidebarItems({
|
||||||
|
baseUrl: siteConfig.baseUrl,
|
||||||
|
version: "v1",
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,19 @@
|
|||||||
import { DocsConfig } from "types"
|
import { DocsConfig } from "types"
|
||||||
import { mobileSidebarItemsV2 } from "docs-ui"
|
import { getMobileSidebarItems } from "docs-ui"
|
||||||
import { generatedSidebar as sidebar } from "@/generated/sidebar.mjs"
|
import { generatedSidebar as sidebar } from "@/generated/sidebar.mjs"
|
||||||
|
|
||||||
|
const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000"
|
||||||
|
|
||||||
export const config: DocsConfig = {
|
export const config: DocsConfig = {
|
||||||
titleSuffix: "Medusa Admin User Guide",
|
titleSuffix: "Medusa Admin User Guide",
|
||||||
baseUrl: process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000",
|
baseUrl,
|
||||||
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
|
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
|
||||||
sidebar: {
|
sidebar: {
|
||||||
top: sidebar,
|
top: sidebar,
|
||||||
bottom: [],
|
bottom: [],
|
||||||
mobile: mobileSidebarItemsV2,
|
mobile: getMobileSidebarItems({
|
||||||
|
baseUrl,
|
||||||
|
version: "v2",
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -52,23 +52,22 @@ export const navbarItemsV1: NavbarItem[] = [
|
|||||||
href: `/ui`,
|
href: `/ui`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// TODO enable them later
|
{
|
||||||
// {
|
type: "divider",
|
||||||
// type: "divider",
|
},
|
||||||
// },
|
{
|
||||||
// {
|
type: "link",
|
||||||
// type: "link",
|
props: {
|
||||||
// props: {
|
label: "Learn Medusa v2",
|
||||||
// label: "Learn Medusa v2",
|
target: "_blank",
|
||||||
// target: "_blank",
|
rel: "noreferrer",
|
||||||
// rel: "noreferrer",
|
href: `/v2`,
|
||||||
// href: `/v2`,
|
badge: {
|
||||||
// badge: {
|
variant: "blue",
|
||||||
// variant: "blue",
|
children: "New",
|
||||||
// children: "New",
|
},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// },
|
|
||||||
]
|
]
|
||||||
|
|
||||||
export const navbarItemsV2: NavbarItem[] = [
|
export const navbarItemsV2: NavbarItem[] = [
|
||||||
@@ -162,13 +161,13 @@ export const mobileSidebarItemsV1: SidebarItemType[] = [
|
|||||||
loaded: true,
|
loaded: true,
|
||||||
isPathHref: true,
|
isPathHref: true,
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// title: "Learn Medusa V2",
|
title: "Learn Medusa V2",
|
||||||
// path: `/v2`,
|
path: `/v2`,
|
||||||
// loaded: true,
|
loaded: true,
|
||||||
// isPathHref: true,
|
isPathHref: true,
|
||||||
// additionalElms: <Badge variant="blue">v2</Badge>,
|
additionalElms: <Badge variant="blue">v2</Badge>,
|
||||||
// },
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
export const mobileSidebarItemsV2: SidebarItemType[] = [
|
export const mobileSidebarItemsV2: SidebarItemType[] = [
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import { SidebarItemType } from "types"
|
||||||
|
import { mobileSidebarItemsV1, mobileSidebarItemsV2 } from ".."
|
||||||
|
|
||||||
|
type Options = {
|
||||||
|
baseUrl: string
|
||||||
|
version?: "v1" | "v2"
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getMobileSidebarItems({
|
||||||
|
baseUrl,
|
||||||
|
version = "v1",
|
||||||
|
}: Options): SidebarItemType[] {
|
||||||
|
const mobileItems =
|
||||||
|
version === "v2" ? mobileSidebarItemsV2 : mobileSidebarItemsV1
|
||||||
|
return mobileItems.map((item) => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
path: `${baseUrl}${item.path}`,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ export * from "./decode-str"
|
|||||||
export * from "./dom-utils"
|
export * from "./dom-utils"
|
||||||
export * from "./format-report-link"
|
export * from "./format-report-link"
|
||||||
export * from "./get-link-with-base-path"
|
export * from "./get-link-with-base-path"
|
||||||
|
export * from "./get-mobile-sidebar-items"
|
||||||
export * from "./get-navbar-items"
|
export * from "./get-navbar-items"
|
||||||
export * from "./get-os-shortcut"
|
export * from "./get-os-shortcut"
|
||||||
export * from "./get-scrolled-top"
|
export * from "./get-scrolled-top"
|
||||||
|
|||||||
Reference in new issue
Block a user