From 67d8b720567f63b784c0e2bba65dfaaa9703fb69 Mon Sep 17 00:00:00 2001
From: Ibrahim Almalki <67344551+Eebro@users.noreply.github.com>
Date: Sun, 3 Mar 2024 18:48:18 -0500
Subject: [PATCH] replace fill styles with svgs (#80)
---
client/src/assets/CrossHatched.tsx | 84 ++++++++++++++++
client/src/assets/Dashed.tsx | 66 +++++++++++++
client/src/assets/Dots.tsx | 99 +++++++++++++++++++
client/src/assets/Hachure.tsx | 44 +++++++++
client/src/assets/None.tsx | 27 +++++
client/src/assets/Solid.tsx | 26 +++++
client/src/assets/Zigzag.tsx | 57 +++++++++++
client/src/assets/ZigzagLine.tsx | 48 +++++++++
client/src/components/lib/ChangeFillStyle.tsx | 30 +++---
9 files changed, 469 insertions(+), 12 deletions(-)
create mode 100644 client/src/assets/CrossHatched.tsx
create mode 100644 client/src/assets/Dashed.tsx
create mode 100644 client/src/assets/Dots.tsx
create mode 100644 client/src/assets/Hachure.tsx
create mode 100644 client/src/assets/None.tsx
create mode 100644 client/src/assets/Solid.tsx
create mode 100644 client/src/assets/Zigzag.tsx
create mode 100644 client/src/assets/ZigzagLine.tsx
diff --git a/client/src/assets/CrossHatched.tsx b/client/src/assets/CrossHatched.tsx
new file mode 100644
index 0000000..3c73cd4
--- /dev/null
+++ b/client/src/assets/CrossHatched.tsx
@@ -0,0 +1,84 @@
+import React from 'react';
+
+const CrossHatchedSVG: React.FC = () => (
+
+);
+
+export default CrossHatchedSVG;
diff --git a/client/src/assets/Dashed.tsx b/client/src/assets/Dashed.tsx
new file mode 100644
index 0000000..c735951
--- /dev/null
+++ b/client/src/assets/Dashed.tsx
@@ -0,0 +1,66 @@
+import React from 'react';
+
+const Dashed: React.FC = () => (
+
+);
+
+export default Dashed;
diff --git a/client/src/assets/Dots.tsx b/client/src/assets/Dots.tsx
new file mode 100644
index 0000000..efc697a
--- /dev/null
+++ b/client/src/assets/Dots.tsx
@@ -0,0 +1,99 @@
+import React from 'react';
+
+const DotsSVG: React.FC = () => (
+
+);
+
+export default DotsSVG;
diff --git a/client/src/assets/Hachure.tsx b/client/src/assets/Hachure.tsx
new file mode 100644
index 0000000..2e27f04
--- /dev/null
+++ b/client/src/assets/Hachure.tsx
@@ -0,0 +1,44 @@
+import React from 'react';
+
+const HachureSVG: React.FC = () => (
+
+);
+
+export default HachureSVG;
diff --git a/client/src/assets/None.tsx b/client/src/assets/None.tsx
new file mode 100644
index 0000000..0444413
--- /dev/null
+++ b/client/src/assets/None.tsx
@@ -0,0 +1,27 @@
+import React from 'react';
+
+const NoneSVG: React.FC = () => (
+
+);
+
+export default NoneSVG;
diff --git a/client/src/assets/Solid.tsx b/client/src/assets/Solid.tsx
new file mode 100644
index 0000000..4940b1d
--- /dev/null
+++ b/client/src/assets/Solid.tsx
@@ -0,0 +1,26 @@
+import React from 'react';
+
+const SolidSVG: React.FC = () => (
+
+);
+
+export default SolidSVG;
diff --git a/client/src/assets/Zigzag.tsx b/client/src/assets/Zigzag.tsx
new file mode 100644
index 0000000..fcb303d
--- /dev/null
+++ b/client/src/assets/Zigzag.tsx
@@ -0,0 +1,57 @@
+import React from 'react';
+
+const ZigzagSVG: React.FC = () => (
+
+);
+
+export default ZigzagSVG;
diff --git a/client/src/assets/ZigzagLine.tsx b/client/src/assets/ZigzagLine.tsx
new file mode 100644
index 0000000..cec7ca1
--- /dev/null
+++ b/client/src/assets/ZigzagLine.tsx
@@ -0,0 +1,48 @@
+import React from 'react';
+
+const ZigzagLineSVG: React.FC = () => (
+
+);
+
+export default ZigzagLineSVG;
diff --git a/client/src/components/lib/ChangeFillStyle.tsx b/client/src/components/lib/ChangeFillStyle.tsx
index b6e99eb..af580c1 100644
--- a/client/src/components/lib/ChangeFillStyle.tsx
+++ b/client/src/components/lib/ChangeFillStyle.tsx
@@ -2,6 +2,14 @@ import React from 'react';
import { useCanvasElementStore } from '@/stores/CanvasElementsStore';
import ToolButton from './ToolButtonSelector';
import { CanvasElementFillStyle } from '@/types';
+import HachureSVG from '@/assets/Hachure';
+import CrossHatchedSVG from '@/assets/CrossHatched';
+import DashedSVG from '@/assets/Dashed';
+import ZigzagLineSVG from '@/assets/ZigzagLine';
+import DotsSVG from '@/assets/Dots';
+import ZigzagSVG from '@/assets/Zigzag';
+import NoneSVG from '@/assets/None';
+import SolidSVG from '@/assets/Solid';
/**
* This file defines the ChangeFillStyle component, which allows the user to select
@@ -11,15 +19,15 @@ import { CanvasElementFillStyle } from '@/types';
* @author Eebro
*/
-const fillStyleMap: Record = {
- none: 'bg-red-500',
- hachure: 'bg-red-500',
- solid: 'bg-green-300',
- zigzag: 'bg-blue-300',
- ['cross-hatch']: 'bg-orange-500',
- dots: 'bg-black',
- dashed: 'bg-blue-500',
- ['zigzag-line']: 'bg-blue-500',
+const fillStyleMap: Record = {
+ none: ,
+ hachure: ,
+ solid: ,
+ zigzag: ,
+ ['cross-hatch']: ,
+ dots: ,
+ dashed: ,
+ ['zigzag-line']: ,
};
const mapFillStyle = {
@@ -56,9 +64,7 @@ const FillStyleToolGroup = ({ tools }: { tools: CanvasElementFillStyle[] }) => {
label={toolName}
active={interestValue === mapFillStyle[toolName]}
>
-
+ {fillStyleMap[toolName]}
))}