Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] fix(KeyComboTag): use static icon imports #6629

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 26 additions & 13 deletions packages/core/src/components/hotkeys/keyComboTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,36 @@
import classNames from "classnames";
import * as React from "react";

import {
ArrowDown,
ArrowLeft,
ArrowRight,
ArrowUp,
KeyCommand,
KeyControl,
KeyDelete,
KeyEnter,
KeyOption,
KeyShift,
} from "@blueprintjs/icons";

import { AbstractPureComponent, Classes, DISPLAYNAME_PREFIX, type Props } from "../../common";
import { Icon, type IconName } from "../icon/icon";
import { Icon } from "../icon/icon";

import { normalizeKeyCombo } from "./hotkeyParser";

const KEY_ICONS: Record<string, { icon: IconName; iconTitle: string }> = {
ArrowDown: { icon: "arrow-down", iconTitle: "Down key" },
ArrowLeft: { icon: "arrow-left", iconTitle: "Left key" },
ArrowRight: { icon: "arrow-right", iconTitle: "Right key" },
ArrowUp: { icon: "arrow-up", iconTitle: "Up key" },
alt: { icon: "key-option", iconTitle: "Alt/Option key" },
cmd: { icon: "key-command", iconTitle: "Command key" },
ctrl: { icon: "key-control", iconTitle: "Control key" },
delete: { icon: "key-delete", iconTitle: "Delete key" },
enter: { icon: "key-enter", iconTitle: "Enter key" },
meta: { icon: "key-command", iconTitle: "Command key" },
shift: { icon: "key-shift", iconTitle: "Shift key" },
const KEY_ICONS: Record<string, { icon: JSX.Element; iconTitle: string }> = {
ArrowDown: { icon: <ArrowDown />, iconTitle: "Down key" },
ArrowLeft: { icon: <ArrowLeft />, iconTitle: "Left key" },
ArrowRight: { icon: <ArrowRight />, iconTitle: "Right key" },
ArrowUp: { icon: <ArrowUp />, iconTitle: "Up key" },
alt: { icon: <KeyOption />, iconTitle: "Alt/Option key" },
cmd: { icon: <KeyCommand />, iconTitle: "Command key" },
ctrl: { icon: <KeyControl />, iconTitle: "Control key" },
delete: { icon: <KeyDelete />, iconTitle: "Delete key" },
enter: { icon: <KeyEnter />, iconTitle: "Enter key" },
meta: { icon: <KeyCommand />, iconTitle: "Command key" },
shift: { icon: <KeyShift />, iconTitle: "Shift key" },
};

/** Reverse table of some CONFIG_ALIASES fields, for display by KeyComboTag */
Expand Down