Fixes in Shortcuts dialog and minor refactor (#1297)

This commit is contained in:
Lipis 2020-04-07 14:39:06 +03:00 committed by GitHub
parent e4c154f43e
commit 0c3d34261e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 96 additions and 82 deletions

View file

@ -6,7 +6,7 @@ import { hasBackground, hasStroke, hasText, getTargetElement } from "../scene";
import { t } from "../i18n";
import { SHAPES } from "../shapes";
import { ToolButton } from "./ToolButton";
import { capitalizeString, getShortcutKey, setCursorForShape } from "../utils";
import { capitalizeString, setCursorForShape } from "../utils";
import Stack from "./Stack";
import useIsMobile from "../is-mobile";
@ -94,9 +94,9 @@ export function ShapesSwitcher({
<>
{SHAPES.map(({ value, icon }, index) => {
const label = t(`toolBar.${value}`);
const shortcut = getShortcutKey(
`${capitalizeString(value)[0]}, ${index + 1}`,
);
const shortcut = `${capitalizeString(value)[0]} ${t(
"shortcutsDialog.or",
)} ${index + 1}`;
return (
<ToolButton
key={value}
@ -104,10 +104,11 @@ export function ShapesSwitcher({
icon={icon}
checked={elementType === value}
name="editor-current-shape"
title={`${capitalizeString(label)} ${shortcut}`}
title={`${capitalizeString(label)} ${shortcut}`}
keyBindingLabel={`${index + 1}`}
aria-label={capitalizeString(label)}
aria-keyshortcuts={`${label[0]} ${index + 1}`}
data-testid={value}
onChange={() => {
setAppState({
elementType: value,