Skip to content

Commit 928c6d5

Browse files
committed
septate components of penColor and canvasColor
1 parent 592ff51 commit 928c6d5

File tree

5 files changed

+43
-22
lines changed

5 files changed

+43
-22
lines changed

client/src/App.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,15 @@ function App() {
125125
return (
126126
<div id="container">
127127
<Sidebar
128+
addStroke={addStroke}
128129
addLineWidth={addLineWidth}
129130
clearOnClick={clearOnClick}
130131
ref={sidebarRef}
131132
id="clear"
132133
toggleMenu={toggleMenu}
133134
></Sidebar>
134135
<Canvas canvasRef={canvasRef}></Canvas>
135-
{ showMenu && <Menu></Menu>}
136+
{showMenu && <Menu></Menu>}
136137
</div>
137138
);
138139
}

client/src/components/CanvasColor.jsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* eslint-disable react/prop-types */
2+
function CanvasColor(props) {
3+
return (
4+
<div className="flex p-1 items-center justify-around mt-3">
5+
<h1 className="font-sans text-lg antialiased font-semibold text-white">
6+
{props.name}
7+
</h1>
8+
<input
9+
type="color"
10+
value={props.defaultColor}
11+
className="p-1 h-10 w-10 block bg-white border border-gray-800 cursor-pointer rounded-lg disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700"
12+
></input>
13+
</div>
14+
);
15+
}
16+
17+
export default CanvasColor;

client/src/components/ColorPicker.jsx

Lines changed: 0 additions & 17 deletions
This file was deleted.

client/src/components/PenColor.jsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* eslint-disable react/prop-types */
2+
function PenColor(props) {
3+
return (
4+
<div className="flex p-1 items-center justify-around mt-3">
5+
<h1 className="font-sans text-lg antialiased font-semibold text-white">
6+
{props.name}
7+
</h1>
8+
<input
9+
type="color"
10+
value={props.defaultColor}
11+
className="p-1 h-10 w-10 block bg-white border border-gray-800 cursor-pointer rounded-lg disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700"
12+
></input>
13+
</div>
14+
);
15+
}
16+
17+
export default PenColor;

client/src/components/Toolbar.jsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
/* eslint-disable react/prop-types */
2-
import ColorPicker from "./ColorPicker";
32
import StrokeWidthPicker from "./StrokeWidthPicker";
43
import ClearBtn from "./ClearBtn";
54
import Eraser from "./Eraser";
5+
import CanvasColor from "./CanvasColor";
6+
import PenColor from "./PenColor";
67

78
function Toolbar(props){
89
return (
910
<div className="block w-full mt-20 align-center">
10-
<ColorPicker name="Colors :" defaultColor="#000000"></ColorPicker>
11-
<ColorPicker name="Canvas :" defaultColor="#FFFFFF"></ColorPicker>
11+
<PenColor addStroke={props.addStroke} name="Color :"></PenColor>
12+
<CanvasColor name="Canvas :"></CanvasColor>
1213
<Eraser></Eraser>
13-
<StrokeWidthPicker addLineWidth={props.addLineWidth} ></StrokeWidthPicker>
14+
<StrokeWidthPicker
15+
addLineWidth={props.addLineWidth}
16+
></StrokeWidthPicker>
1417
<ClearBtn clearOnClick={props.clearOnClick} id={props.id}></ClearBtn>
1518
</div>
1619
);

0 commit comments

Comments
 (0)