No named colors and lowercase hex (#395)

* No named colors and lowercase hex

* consistent
This commit is contained in:
Lipis 2020-01-16 20:16:08 +02:00 committed by Christopher Chedeau
parent 1ae3c64860
commit 8154ccd907
7 changed files with 57 additions and 64 deletions

View file

@ -60,14 +60,7 @@ export const SHAPES = [
icon: (
// custom
<svg viewBox="0 0 6 6">
<line
x1="0"
y1="3"
x2="6"
y2="3"
stroke="black"
strokeLinecap="round"
/>
<line x1="0" y1="3" x2="6" y2="3" stroke="#000" strokeLinecap="round" />
</svg>
),
value: "line"
@ -75,13 +68,15 @@ export const SHAPES = [
];
export const shapesShortcutKeys = SHAPES.map((shape, index) => [
shape.value[0], (index + 1).toString()]
).flat(1);
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;
if (shape.value[0] !== key && key !== (index + 1).toString())
return element;
return shape.value;
}, defaultElement);