diff --git a/package-lock.json b/package-lock.json index 017c3dfd..b02c66f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1000,6 +1000,35 @@ "resolved": "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-10.1.0.tgz", "integrity": "sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg==" }, + "@fortawesome/fontawesome-common-types": { + "version": "0.2.26", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.26.tgz", + "integrity": "sha512-CcM/fIFwZlRdiWG/25xE/wHbtyUuCtqoCTrr6BsWw7hH072fR++n4L56KPydAr3ANgMJMjT8v83ZFIsDc7kE+A==" + }, + "@fortawesome/fontawesome-svg-core": { + "version": "1.2.26", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-1.2.26.tgz", + "integrity": "sha512-3Dfd/v2IztP1TxKOxZiB5+4kaOZK9mNy0KU1vVK7nFlPWz3gzxrCWB+AloQhQUoJ8HhGqbzjliK89Vl7PExGbw==", + "requires": { + "@fortawesome/fontawesome-common-types": "^0.2.26" + } + }, + "@fortawesome/free-solid-svg-icons": { + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-5.12.0.tgz", + "integrity": "sha512-CnpsWs6GhTs9ekNB3d8rcO5HYqRkXbYKf2YNiAlTWbj5eVlPqsd/XH1F9If8jkcR1aegryAbln/qYeKVZzpM0g==", + "requires": { + "@fortawesome/fontawesome-common-types": "^0.2.26" + } + }, + "@fortawesome/react-fontawesome": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/@fortawesome/react-fontawesome/-/react-fontawesome-0.1.8.tgz", + "integrity": "sha512-I5h9YQg/ePA3Br9ISS18fcwOYmzQYDSM1ftH03/8nHkiqIVHtUyQBw482+60dnzvlr82gHt3mGm+nDUp159FCw==", + "requires": { + "prop-types": "^15.5.10" + } + }, "@hapi/address": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz", diff --git a/package.json b/package.json index dec9ef38..ece0d658 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,9 @@ "keywords": [], "main": "src/index.js", "dependencies": { + "@fortawesome/fontawesome-svg-core": "^1.2.26", + "@fortawesome/free-solid-svg-icons": "^5.12.0", + "@fortawesome/react-fontawesome": "^0.1.8", "lodash": "4.17.15", "react": "16.12.0", "react-dom": "16.12.0", diff --git a/src/index.tsx b/src/index.tsx index 8e947c65..4ad3a7f7 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -2,6 +2,14 @@ import React from "react"; import ReactDOM from "react-dom"; import rough from "roughjs/bin/wrappers/rough"; import { RoughCanvas } from "roughjs/bin/canvas"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { + faMousePointer, + faSquare, + faCircle, + faLongArrowAltRight, + faFont +} from "@fortawesome/free-solid-svg-icons"; import "./styles.css"; @@ -598,28 +606,28 @@ const KEYS = { const SHAPES = [ { - label: "Rectange", + icon: faMousePointer, + value: "selection" + }, + { + icon: faSquare, value: "rectangle" }, { - label: "Ellipse", + icon: faCircle, value: "ellipse" }, { - label: "Arrow", + icon: faLongArrowAltRight, value: "arrow" }, { - label: "Text", + icon: faFont, value: "text" - }, - { - label: "Selection", - value: "selection" } ]; -const shapesShortcutKeys = SHAPES.map(shape => shape.label[0].toLowerCase()); +const shapesShortcutKeys = SHAPES.map(shape => shape.value[0]); function findElementByKey(key: string) { const defaultElement = "selection"; @@ -716,6 +724,7 @@ class App extends React.Component<{}, AppState> { public render() { return (