import React from "react";
import oc from "open-color";
// 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",
key: "s",
},
{
icon: (
// fa-square
),
value: "rectangle",
key: "r",
},
{
icon: (
// custom
),
value: "diamond",
key: "d",
},
{
icon: (
// fa-circle
),
value: "ellipse",
key: "e",
},
{
icon: (
// fa-long-arrow-alt-right
),
value: "arrow",
key: "a",
},
{
icon: (
// custom
),
value: "line",
key: "l",
},
{
icon: (
// fa-pencil
),
value: "draw",
key: "x",
},
{
icon: (
// fa-font
),
value: "text",
key: "t",
},
] as const;
export const shapesShortcutKeys = SHAPES.map((shape, index) => [
shape.key,
(index + 1).toString(),
]).flat(1);
export const findShapeByKey = (key: string) =>
SHAPES.find((shape, index) => {
return shape.key === key.toLowerCase() || key === (index + 1).toString();
})?.value || "selection";