docs: add help dropdown (#11364)
This commit is contained in:
@@ -1,12 +1,6 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import {
|
import { BarsThree, Book, SidebarLeft, TimelineVertical } from "@medusajs/icons"
|
||||||
BarsThree,
|
|
||||||
Book,
|
|
||||||
QuestionMarkCircle,
|
|
||||||
SidebarLeft,
|
|
||||||
TimelineVertical,
|
|
||||||
} from "@medusajs/icons"
|
|
||||||
import React, { useMemo, useRef, useState } from "react"
|
import React, { useMemo, useRef, useState } from "react"
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
@@ -51,12 +45,6 @@ export const MainNavDesktopMenu = () => {
|
|||||||
title: "Changelog",
|
title: "Changelog",
|
||||||
link: "https://medusajs.com/changelog",
|
link: "https://medusajs.com/changelog",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
type: "link",
|
|
||||||
icon: <QuestionMarkCircle />,
|
|
||||||
title: "Troubleshooting",
|
|
||||||
link: "https://docs.medusajs.com/resources/troubleshooting",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
|
|
||||||
if (isSidebarShown) {
|
if (isSidebarShown) {
|
||||||
|
|||||||
@@ -9,18 +9,22 @@ import { Menu } from "../../../.."
|
|||||||
type MainNavItemDropdownProps = {
|
type MainNavItemDropdownProps = {
|
||||||
item: NavigationItemDropdown
|
item: NavigationItemDropdown
|
||||||
isActive: boolean
|
isActive: boolean
|
||||||
|
className?: string
|
||||||
|
wrapperClassName?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MainNavItemDropdown = ({
|
export const MainNavItemDropdown = ({
|
||||||
item,
|
item,
|
||||||
isActive,
|
isActive,
|
||||||
|
className,
|
||||||
|
wrapperClassName,
|
||||||
}: MainNavItemDropdownProps) => {
|
}: MainNavItemDropdownProps) => {
|
||||||
const [isOpen, setIsOpen] = useState(false)
|
const [isOpen, setIsOpen] = useState(false)
|
||||||
const ref = useRef<HTMLDivElement>(null)
|
const ref = useRef<HTMLDivElement>(null)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={clsx("relative")}
|
className={clsx("relative", wrapperClassName)}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
onMouseOver={() => setIsOpen(true)}
|
onMouseOver={() => setIsOpen(true)}
|
||||||
onMouseLeave={() => setIsOpen(false)}
|
onMouseLeave={() => setIsOpen(false)}
|
||||||
@@ -32,7 +36,8 @@ export const MainNavItemDropdown = ({
|
|||||||
!isActive && [
|
!isActive && [
|
||||||
"text-medusa-fg-muted hover:text-medusa-fg-subtle",
|
"text-medusa-fg-muted hover:text-medusa-fg-subtle",
|
||||||
isOpen && "text-medusa-fg-subtle",
|
isOpen && "text-medusa-fg-subtle",
|
||||||
]
|
],
|
||||||
|
className
|
||||||
)}
|
)}
|
||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import React from "react"
|
|||||||
import {
|
import {
|
||||||
BorderedIcon,
|
BorderedIcon,
|
||||||
Button,
|
Button,
|
||||||
|
GITHUB_ISSUES_LINK,
|
||||||
LinkButton,
|
LinkButton,
|
||||||
SearchModalOpener,
|
SearchModalOpener,
|
||||||
useLayout,
|
useLayout,
|
||||||
@@ -20,6 +21,7 @@ import { MainNavMobileMenu } from "./MobileMenu"
|
|||||||
import Link from "next/link"
|
import Link from "next/link"
|
||||||
import { MainNavVersion } from "./Version"
|
import { MainNavVersion } from "./Version"
|
||||||
import { AiAssistantTriggerButton } from "../AiAssistant/TriggerButton"
|
import { AiAssistantTriggerButton } from "../AiAssistant/TriggerButton"
|
||||||
|
import { MainNavItemDropdown } from "./Items/Dropdown"
|
||||||
|
|
||||||
type MainNavProps = {
|
type MainNavProps = {
|
||||||
className?: string
|
className?: string
|
||||||
@@ -74,14 +76,40 @@ export const MainNav = ({ className, itemsClassName }: MainNavProps) => {
|
|||||||
<div className="lg:flex items-center gap-docs_0.5 text-medusa-fg-subtle hidden">
|
<div className="lg:flex items-center gap-docs_0.5 text-medusa-fg-subtle hidden">
|
||||||
<MainNavVersion />
|
<MainNavVersion />
|
||||||
{editDate && <MainNavEditDate date={editDate} />}
|
{editDate && <MainNavEditDate date={editDate} />}
|
||||||
<LinkButton
|
<MainNavItemDropdown
|
||||||
href={config.reportIssueLink || ""}
|
item={{
|
||||||
variant="subtle"
|
type: "dropdown",
|
||||||
target="_blank"
|
title: "Help",
|
||||||
className="text-compact-small-plus"
|
children: [
|
||||||
>
|
{
|
||||||
Report Issue
|
type: "link",
|
||||||
</LinkButton>
|
title: "Troubleshooting",
|
||||||
|
link: "/resources/troubleshooting",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
title: "Report Issue",
|
||||||
|
link: GITHUB_ISSUES_LINK,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
title: "Discord Community",
|
||||||
|
link: "https://discord.gg/medusajs",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "divider",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "link",
|
||||||
|
title: "Contact Sales",
|
||||||
|
link: "https://medusajs.com/contact/",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}}
|
||||||
|
isActive={false}
|
||||||
|
className="text-medusa-fg-subtle"
|
||||||
|
wrapperClassName="z-10"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-docs_0.25">
|
<div className="flex items-center gap-docs_0.25">
|
||||||
<AiAssistantTriggerButton />
|
<AiAssistantTriggerButton />
|
||||||
|
|||||||
Reference in New Issue
Block a user