diff --git a/www/apps/docs/content/upgrade-guides/medusa-ui/index.mdx b/www/apps/docs/content/upgrade-guides/medusa-ui/index.mdx new file mode 100644 index 0000000000..8701934d64 --- /dev/null +++ b/www/apps/docs/content/upgrade-guides/medusa-ui/index.mdx @@ -0,0 +1,11 @@ +--- +sidebar_custom_props: + exclude_from_auto_sidebar: true + exclude_from_doc_list: true +--- + +import DocCardList from '@theme/DocCardList'; + +# Medusa UI Upgrade Guides + + \ No newline at end of file diff --git a/www/apps/docs/docusaurus.config.js b/www/apps/docs/docusaurus.config.js index 0aeac47d27..d0d3310a35 100644 --- a/www/apps/docs/docusaurus.config.js +++ b/www/apps/docs/docusaurus.config.js @@ -1,7 +1,8 @@ /* eslint-disable @typescript-eslint/no-var-requires */ require("dotenv").config() const fs = require("fs") -const reverseSidebar = require("./src/utils/reverseSidebar") +const reverseSidebar = require("./src/utils/reverse-sidebar") +const excludeSidebarResults = require("./src/utils/exclude-sidebar-results") const announcementBar = JSON.parse(fs.readFileSync("./announcement.json")) @@ -251,7 +252,10 @@ const config = { ...args }) { const sidebarItems = await defaultSidebarItemsGenerator(args) - return reverseSidebar(sidebarItems, args.item) + return reverseSidebar( + excludeSidebarResults(sidebarItems, args.item), + args.item + ) }, }, theme: { diff --git a/www/apps/docs/sidebars.js b/www/apps/docs/sidebars.js index f98eace014..0fce40c378 100644 --- a/www/apps/docs/sidebars.js +++ b/www/apps/docs/sidebars.js @@ -53,7 +53,7 @@ module.exports = { label: "Ecommerce", customProps: { iconName: "shopping-cart", - excludeFromDocList: true, + exclude_from_doc_list: true, }, }, { @@ -1951,6 +1951,10 @@ module.exports = { customProps: { sidebar_is_group_headline: true, }, + link: { + type: "doc", + id: "upgrade-guides/medusa-ui/index", + }, items: [ { type: "autogenerated", diff --git a/www/apps/docs/src/theme/DocCardList/index.tsx b/www/apps/docs/src/theme/DocCardList/index.tsx index 795a45b984..88497dfb6f 100644 --- a/www/apps/docs/src/theme/DocCardList/index.tsx +++ b/www/apps/docs/src/theme/DocCardList/index.tsx @@ -7,9 +7,12 @@ import { import DocCard from "@theme/DocCard" import type { Props } from "@theme/DocCardList" -function DocCardListForCurrentSidebarCategory({ className }: Props) { +function DocCardListForCurrentSidebarCategory({ + className, + ...rest +}: ModifiedProps) { const category = useCurrentSidebarCategory() - return + return } type ModifiedProps = { @@ -22,7 +25,7 @@ export default function DocCardList(props: ModifiedProps): JSX.Element { return } const filteredItems = filterDocCardListItems(items).filter( - (item) => !item.customProps.excludeFromDocList + (item) => !item.customProps?.exclude_from_doclist ) return ( diff --git a/www/apps/docs/src/utils/exclude-sidebar-results.js b/www/apps/docs/src/utils/exclude-sidebar-results.js new file mode 100644 index 0000000000..4925583d73 --- /dev/null +++ b/www/apps/docs/src/utils/exclude-sidebar-results.js @@ -0,0 +1,17 @@ +function excludeSidebarResults(sidebarItems, categoryItem) { + const results = [] + sidebarItems.forEach((item) => { + if (item.type === "category") { + results.push({ + ...item, + items: excludeSidebarResults(item.items, categoryItem), + }) + } else if (!item.customProps?.exclude_from_auto_sidebar) { + return results.push(item) + } + }) + + return results +} + +module.exports = excludeSidebarResults diff --git a/www/apps/docs/src/utils/reverseSidebar.js b/www/apps/docs/src/utils/reverse-sidebar.js similarity index 100% rename from www/apps/docs/src/utils/reverseSidebar.js rename to www/apps/docs/src/utils/reverse-sidebar.js diff --git a/www/apps/ui/src/config/docs.ts b/www/apps/ui/src/config/docs.tsx similarity index 95% rename from www/apps/ui/src/config/docs.ts rename to www/apps/ui/src/config/docs.tsx index 87b17f8c17..715579d7f0 100644 --- a/www/apps/ui/src/config/docs.ts +++ b/www/apps/ui/src/config/docs.tsx @@ -1,3 +1,4 @@ +import { ArrowUpRightOnBox } from "@medusajs/icons" import { NavbarLinkProps, SidebarSectionItemsType } from "docs-ui" type DocsConfig = { @@ -65,6 +66,16 @@ export const docsConfig: DocsConfig = { path: "/installation/standalone-project", isPathHref: true, }, + { + title: "Upgrade Guides", + path: `${process.env.NEXT_PUBLIC_DOCS_URL}/upgrade-guides/medusa-ui`, + isPathHref: true, + additionalElms: , + linkProps: { + target: "_blank", + rel: "noreferrer", + }, + }, ], }, ], diff --git a/www/packages/docs-ui/src/components/Sidebar/Item/index.tsx b/www/packages/docs-ui/src/components/Sidebar/Item/index.tsx index fe1077f08f..53165303d1 100644 --- a/www/packages/docs-ui/src/components/Sidebar/Item/index.tsx +++ b/www/packages/docs-ui/src/components/Sidebar/Item/index.tsx @@ -94,6 +94,7 @@ export const SidebarItem = ({ }} replace shallow + {...item.linkProps} > {item.title} {item.additionalElms} diff --git a/www/packages/docs-ui/src/providers/Sidebar/index.tsx b/www/packages/docs-ui/src/providers/Sidebar/index.tsx index bdfa57ce4a..7c2b0523a4 100644 --- a/www/packages/docs-ui/src/providers/Sidebar/index.tsx +++ b/www/packages/docs-ui/src/providers/Sidebar/index.tsx @@ -24,6 +24,7 @@ export type SidebarItemType = { children?: SidebarItemType[] loaded?: boolean isPathHref?: boolean + linkProps?: React.AllHTMLAttributes } export type SidebarSectionItemsType = {