diff --git a/src/renderer/src/components/ui/button/index.tsx b/src/renderer/src/components/ui/button/index.tsx index d9d49ffcc..85b21f507 100644 --- a/src/renderer/src/components/ui/button/index.tsx +++ b/src/renderer/src/components/ui/button/index.tsx @@ -8,7 +8,7 @@ import * as React from "react" import { useHotkeys } from "react-hotkeys-hook" import type { OptionsOrDependencyArray } from "react-hotkeys-hook/dist/types" -import { Kbd } from "../kbd/Kbd" +import { KbdCombined } from "../kbd/Kbd" import { LoadingCircle } from "../loading" import { Tooltip, TooltipContent, TooltipTrigger } from "../tooltip" import { buttonVariants, styledButtonVariant } from "./variants" @@ -38,7 +38,7 @@ export const Button = React.forwardRef( }, ref, ) => { - const Comp = asChild ? Slot : as as any + const Comp = asChild ? Slot : (as as any) return ( - + {tooltip} -
- {shortcut && {shortcut}} -
+ {!!shortcut && ( +
+ + {shortcut} + +
+ )}
@@ -193,10 +200,13 @@ export const StyledButton = React.forwardRef< return ( diff --git a/src/renderer/src/components/ui/context-menu/context-menu.tsx b/src/renderer/src/components/ui/context-menu/context-menu.tsx index 4cfa560a6..09ea3abca 100644 --- a/src/renderer/src/components/ui/context-menu/context-menu.tsx +++ b/src/renderer/src/components/ui/context-menu/context-menu.tsx @@ -77,7 +77,7 @@ const ContextMenuItem = React.forwardRef< = ({ children, className }) => { @@ -33,10 +34,27 @@ export const Kbd: FC<{ } return ( -
- {key.split(",").map((k) => ( - {k} +
+ {key.split(",").map((k, i) => ( + +
+ {k.split("+").map((key, index) => ( + + {key} + + ))} +
+ {i !== key.split(",").length - 1 && " / "} +
))}
) } + +export const Kbd: FC<{ children: string, className?: string }> = memo( + ({ children, className }) => ( + + {children} + + ), +) diff --git a/src/renderer/src/components/ui/tooltip.tsx b/src/renderer/src/components/ui/tooltip.tsx index e44d2e3c1..ad23b3b20 100644 --- a/src/renderer/src/components/ui/tooltip.tsx +++ b/src/renderer/src/components/ui/tooltip.tsx @@ -16,7 +16,7 @@ const TooltipContent = React.forwardRef< ref={ref} sideOffset={sideOffset} className={cn( - "z-[101] overflow-hidden border border-border bg-theme-tooltip-background px-2 py-1 text-theme-tooltip-foreground backdrop-blur-xl", + "z-[101] overflow-hidden border border-border bg-theme-tooltip-background px-1.5 py-1 text-theme-tooltip-foreground backdrop-blur-xl", "animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", "rounded-lg text-xs", "max-w-[75ch] select-text", diff --git a/src/renderer/src/pages/settings/(settings)/shortcuts.tsx b/src/renderer/src/pages/settings/(settings)/shortcuts.tsx index a223f1497..e634b228a 100644 --- a/src/renderer/src/pages/settings/(settings)/shortcuts.tsx +++ b/src/renderer/src/pages/settings/(settings)/shortcuts.tsx @@ -1,4 +1,4 @@ -import { Kbd } from "@renderer/components/ui/kbd/Kbd" +import { KbdCombined } from "@renderer/components/ui/kbd/Kbd" import { shortcuts } from "@renderer/constants/shortcuts" import { cn } from "@renderer/lib/utils" import { SettingsTitle } from "@renderer/modules/settings/title" @@ -32,9 +32,9 @@ export function Component() { >
{shortcuts[type][action].name}
- + {`${shortcuts[type][action].key}${shortcuts[type][action].extra ? `, ${shortcuts[type][action].extra}` : ""}`} - +
))} diff --git a/src/renderer/src/providers/context-menu-provider.tsx b/src/renderer/src/providers/context-menu-provider.tsx index 85180a61b..27aac2211 100644 --- a/src/renderer/src/providers/context-menu-provider.tsx +++ b/src/renderer/src/providers/context-menu-provider.tsx @@ -5,7 +5,7 @@ import { ContextMenuSeparator, ContextMenuTrigger, } from "@renderer/components/ui/context-menu" -import { Kbd } from "@renderer/components/ui/kbd/Kbd" +import { KbdCombined } from "@renderer/components/ui/kbd/Kbd" import { nextFrame } from "@renderer/lib/dom" import type { NativeMenuItem } from "@renderer/lib/native-menu" import { CONTEXT_MENU_SHOW_EVENT_KEY } from "@renderer/lib/native-menu" @@ -126,7 +126,7 @@ const Item = memo(({ item }: { item: NativeMenuItem }) => { {!!item.shortcut && (
- {item.shortcut} + {item.shortcut}
)}