docs: update documentation websites (#5882)
* docs: update next.js to 14.0.4 * update docusaurus to v3.0.1 * update packages dependencies * added engines * update lock
This commit is contained in:
@@ -22,10 +22,11 @@
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"@cloudinary/react": "^1.11.2",
|
||||
"@cloudinary/url-gen": "^1.9.2",
|
||||
"@docusaurus/core": "3.0.0",
|
||||
"@docusaurus/preset-classic": "3.0.0",
|
||||
"@docusaurus/remark-plugin-npm2yarn": "3.0.0",
|
||||
"@docusaurus/theme-mermaid": "^3.0.0",
|
||||
"@docusaurus/core": "3.0.1",
|
||||
"@docusaurus/preset-classic": "3.0.1",
|
||||
"@docusaurus/remark-plugin-npm2yarn": "3.0.1",
|
||||
"@docusaurus/theme-mermaid": "3.0.1",
|
||||
"@mdx-js/mdx": "3.0.0",
|
||||
"@mdx-js/react": "3",
|
||||
"@medusajs/icons": "^1.0.0",
|
||||
"@svgr/webpack": "6.2.1",
|
||||
@@ -64,9 +65,9 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/plugin-proposal-decorators": "^7.22.15",
|
||||
"@docusaurus/module-type-aliases": "3.0.0",
|
||||
"@docusaurus/tsconfig": "3.0.0",
|
||||
"@docusaurus/types": "3.0.0",
|
||||
"@docusaurus/module-type-aliases": "3.0.1",
|
||||
"@docusaurus/tsconfig": "3.0.1",
|
||||
"@docusaurus/types": "3.0.1",
|
||||
"@types/react": "^18.2.0",
|
||||
"@types/react-dom": "^18.2.0",
|
||||
"@types/react-transition-group": "^4.4.6",
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
import React, { memo, useMemo } from "react"
|
||||
import {
|
||||
DocSidebarItemsExpandedStateProvider,
|
||||
isActiveSidebarItem,
|
||||
} from "@docusaurus/theme-common/internal"
|
||||
import DocSidebarItem from "@theme/DocSidebarItem"
|
||||
import type { PropSidebarItem } from "@docusaurus/plugin-content-docs"
|
||||
|
||||
import type { Props } from "@theme/DocSidebarItems"
|
||||
|
||||
function DocSidebarItems({ items, ...props }: Props): JSX.Element {
|
||||
// This acts as a fix to a bug in docusaurus which should be part
|
||||
// of an upcoming release.
|
||||
function isVisibleSidebarItem(
|
||||
item: PropSidebarItem,
|
||||
activePath: string
|
||||
): boolean {
|
||||
switch (item.type) {
|
||||
case "category":
|
||||
return (
|
||||
isActiveSidebarItem(item, activePath) ||
|
||||
item.items.some((subItem) =>
|
||||
isVisibleSidebarItem(subItem, activePath)
|
||||
)
|
||||
)
|
||||
case "link":
|
||||
// An unlisted item remains visible if it is active
|
||||
return !item.unlisted || isActiveSidebarItem(item, activePath)
|
||||
default:
|
||||
return true
|
||||
}
|
||||
}
|
||||
function useVisibleSidebarItems(
|
||||
items: readonly PropSidebarItem[],
|
||||
activePath: string
|
||||
): PropSidebarItem[] {
|
||||
return useMemo(
|
||||
() => items.filter((item) => isVisibleSidebarItem(item, activePath)),
|
||||
[items, activePath]
|
||||
)
|
||||
}
|
||||
|
||||
const visibleItems = useVisibleSidebarItems(items, props.activePath)
|
||||
return (
|
||||
<DocSidebarItemsExpandedStateProvider>
|
||||
{visibleItems.map((item, index) => (
|
||||
<DocSidebarItem key={index} item={item} index={index} {...props} />
|
||||
))}
|
||||
</DocSidebarItemsExpandedStateProvider>
|
||||
)
|
||||
}
|
||||
|
||||
// Optimize sidebar at each "level"
|
||||
export default memo(DocSidebarItems)
|
||||
Reference in New Issue
Block a user