Skip to content

Commit 4682fd6

Browse files
committed
connect penColor UI with functionality
1 parent 928c6d5 commit 4682fd6

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

client/src/App.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function App() {
107107
}
108108

109109
function addStroke(e) {
110-
if (e.target.id === "stroke") {
110+
if (e.target.id === "penColor") {
111111
const newColor = e.target.value;
112112
color = newColor;
113113
ctx.strokeStyle = newColor;
@@ -126,6 +126,7 @@ function App() {
126126
<div id="container">
127127
<Sidebar
128128
addStroke={addStroke}
129+
129130
addLineWidth={addLineWidth}
130131
clearOnClick={clearOnClick}
131132
ref={sidebarRef}

client/src/components/PenColor.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ function PenColor(props) {
66
{props.name}
77
</h1>
88
<input
9+
id="penColor"
910
type="color"
11+
onChange={props.addStroke}
1012
value={props.defaultColor}
1113
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"
1214
></input>

client/src/components/Sidebar.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function Sidebar(props){
1414
clearOnClick={props.clearOnClick}
1515
id={props.id}
1616
addLineWidth={props.addLineWidth}
17+
addStroke={props.addStroke}
1718
></Toolbar>
1819
<LoginAndLogout></LoginAndLogout>
1920
</div>

0 commit comments

Comments
 (0)