docs: prepare configuration (#7877)

* update configuration

* resolve todos + remove events guides

* disable v2 docs in v1 navbar

* remove v2 from v1 mobile sidebar

* resolve build errors

* fix build errors

* fix lint errors

* fix lint
This commit is contained in:
Shahed Nasser
2024-07-03 19:27:13 +03:00
committed by GitHub
parent 012a624ee4
commit 6713d76db3
57 changed files with 2626 additions and 2906 deletions
+29 -123
View File
@@ -52,22 +52,23 @@ export const navbarItemsV1: NavbarItem[] = [
href: `/ui`,
},
},
{
type: "divider",
},
{
type: "link",
props: {
label: "Learn Medusa v2",
target: "_blank",
rel: "noreferrer",
href: `/v2`,
badge: {
variant: "blue",
children: "New",
},
},
},
// TODO enable them later
// {
// type: "divider",
// },
// {
// type: "link",
// props: {
// label: "Learn Medusa v2",
// target: "_blank",
// rel: "noreferrer",
// href: `/v2`,
// badge: {
// variant: "blue",
// children: "New",
// },
// },
// },
]
export const navbarItemsV2: NavbarItem[] = [
@@ -122,71 +123,10 @@ export const navbarItemsV2: NavbarItem[] = [
{
type: "link",
props: {
label: "Medusa V1",
label: "Medusa v1",
target: "_blank",
rel: "noreferrer",
href: `/`,
badge: {
variant: "neutral",
children: "v1",
},
},
},
]
export const legacyNavbarItems: NavbarItem[] = [
{
type: "link",
props: {
label: "Docs",
target: "_blank",
rel: "noreferrer",
href: `/`,
},
},
{
type: "link",
props: {
label: "Resources",
target: "_blank",
rel: "noreferrer",
href: `/resources`,
},
},
{
type: "link",
props: {
label: "User Guide",
target: "_blank",
rel: "noreferrer",
href: `/user-guide`,
},
},
{
type: "link",
props: {
label: "Store API",
target: "_blank",
rel: "noreferrer",
href: `/api/store`,
},
},
{
type: "link",
props: {
label: "Admin API",
target: "_blank",
rel: "noreferrer",
href: `/api/admin`,
},
},
{
type: "link",
props: {
label: "UI",
target: "_blank",
rel: "noreferrer",
href: `/ui`,
},
},
]
@@ -222,13 +162,13 @@ export const mobileSidebarItemsV1: SidebarItemType[] = [
loaded: true,
isPathHref: true,
},
{
title: "Learn Medusa V2",
path: `/v2`,
loaded: true,
isPathHref: true,
additionalElms: <Badge variant="blue">v2</Badge>,
},
// {
// title: "Learn Medusa V2",
// path: `/v2`,
// loaded: true,
// isPathHref: true,
// additionalElms: <Badge variant="blue">v2</Badge>,
// },
]
export const mobileSidebarItemsV2: SidebarItemType[] = [
@@ -263,51 +203,17 @@ export const mobileSidebarItemsV2: SidebarItemType[] = [
isPathHref: true,
},
{
title: "Docs",
title: "Medusa v1",
path: `/`,
loaded: true,
isPathHref: true,
additionalElms: <Badge variant="neutral">v1</Badge>,
},
]
export const legacyMobileSidebarItems: SidebarItemType[] = [
{
title: "Docs",
path: `/`,
loaded: true,
isPathHref: true,
},
{
title: "User Guide",
path: `/user-guide`,
loaded: true,
isPathHref: true,
},
{
title: "Store API",
path: `/api/store`,
loaded: true,
isPathHref: true,
},
{
title: "Admin API",
path: `/api/admin`,
loaded: true,
isPathHref: true,
},
{
title: "UI",
path: `/ui`,
loaded: true,
isPathHref: true,
},
]
export const searchFiltersV2: OptionType[] = [
{
value: "book",
label: "Docs V2",
label: "Docs v2",
},
{
value: "resources",
@@ -315,11 +221,11 @@ export const searchFiltersV2: OptionType[] = [
},
{
value: "admin-v2",
label: "Admin API",
label: "Admin API (v2)",
},
{
value: "store-v2",
label: "Store API",
label: "Store API (v2)",
},
// TODO add more filters
]
@@ -1,22 +1,17 @@
import { NavbarItem, legacyNavbarItems, navbarItemsV1, navbarItemsV2 } from ".."
import { NavbarItem, navbarItemsV1, navbarItemsV2 } from ".."
type Options = {
basePath: string
activePath: string
version?: "v1" | "v2" | "legacy"
version?: "v1" | "v2"
}
export function getNavbarItems({
basePath,
activePath,
version = "legacy",
version = "v1",
}: Options): NavbarItem[] {
const navbarItems =
version === "v2"
? navbarItemsV2
: version === "v1"
? navbarItemsV1
: legacyNavbarItems
const navbarItems = version === "v2" ? navbarItemsV2 : navbarItemsV1
return navbarItems.map((item) => {
if (item.type === "divider") {
return item