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: ( // custom ), value: "line", }, { icon: ( // fa-font ), value: "text", }, ]; export const shapesShortcutKeys = SHAPES.map((shape, index) => [ shape.value[0], (index + 1).toString(), ]).flat(1); export function findShapeByKey(key: string) { const defaultElement = "selection"; return SHAPES.reduce((element, shape, index) => { if (shape.value[0] !== key && key !== (index + 1).toString()) { return element; } return shape.value; }, defaultElement); }