import React from "react"; // We inline font-awesome icons in order to save on js size rather than including the font awesome react library export const SHAPES = [ { icon: ( // fa-mouse-pointer ), value: "selection" }, { icon: ( // fa-square ), value: "rectangle" }, { icon: ( // custom ), value: "diamond" }, { icon: ( // fa-circle ), value: "ellipse" }, { icon: ( // fa-long-arrow-alt-right ), value: "arrow" }, { icon: ( // fa-font ), value: "text" } ]; export const shapesShortcutKeys = SHAPES.map(shape => shape.value[0]); export function findShapeByKey(key: string) { const defaultElement = "selection"; return SHAPES.reduce((element, shape) => { if (shape.value[0] !== key) return element; return shape.value; }, defaultElement); }