Заголовок меню — обычный div вместо DropdownMenuLabel, чтобы исключить Base UI error #31 в production. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
DropdownMenuGroup,
|
|
||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuLabel,
|
|
||||||
DropdownMenuShortcut,
|
DropdownMenuShortcut,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from '@cfdm/ui/components/dropdown-menu'
|
} from '@cfdm/ui/components/dropdown-menu'
|
||||||
@@ -59,39 +57,37 @@ export function AppSwitcher() {
|
|||||||
align="start"
|
align="start"
|
||||||
sideOffset={4}
|
sideOffset={4}
|
||||||
>
|
>
|
||||||
<DropdownMenuGroup>
|
<div className="px-2 py-1.5 text-xs text-muted-foreground">
|
||||||
<DropdownMenuLabel className="text-xs text-muted-foreground">
|
{config.menuLabel}
|
||||||
{config.menuLabel}
|
</div>
|
||||||
</DropdownMenuLabel>
|
{config.apps.map((app) => {
|
||||||
{config.apps.map((app) => {
|
const Icon = APP_SWITCHER_ICONS[app.icon]
|
||||||
const Icon = APP_SWITCHER_ICONS[app.icon]
|
const isCurrent = app.id === CURRENT_APP_ID
|
||||||
const isCurrent = app.id === CURRENT_APP_ID
|
|
||||||
|
|
||||||
if (isCurrent) {
|
|
||||||
return (
|
|
||||||
<DropdownMenuItem key={app.id} disabled>
|
|
||||||
<Icon />
|
|
||||||
{app.name}
|
|
||||||
<CheckIcon className="ml-auto size-4" />
|
|
||||||
</DropdownMenuItem>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (isCurrent) {
|
||||||
return (
|
return (
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem key={app.id} disabled>
|
||||||
key={app.id}
|
|
||||||
nativeButton={false}
|
|
||||||
render={<a href={app.url} />}
|
|
||||||
>
|
|
||||||
<Icon />
|
<Icon />
|
||||||
{app.name}
|
{app.name}
|
||||||
{app.shortcut ? (
|
<CheckIcon className="ml-auto size-4" />
|
||||||
<DropdownMenuShortcut>{app.shortcut}</DropdownMenuShortcut>
|
|
||||||
) : null}
|
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
)
|
)
|
||||||
})}
|
}
|
||||||
</DropdownMenuGroup>
|
|
||||||
|
return (
|
||||||
|
<DropdownMenuItem
|
||||||
|
key={app.id}
|
||||||
|
nativeButton={false}
|
||||||
|
render={<a href={app.url} />}
|
||||||
|
>
|
||||||
|
<Icon />
|
||||||
|
{app.name}
|
||||||
|
{app.shortcut ? (
|
||||||
|
<DropdownMenuShortcut>{app.shortcut}</DropdownMenuShortcut>
|
||||||
|
) : null}
|
||||||
|
</DropdownMenuItem>
|
||||||
|
)
|
||||||
|
})}
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
</SidebarMenuItem>
|
</SidebarMenuItem>
|
||||||
|
|||||||
Reference in New Issue
Block a user