File tree Expand file tree Collapse file tree 5 files changed +53
-18
lines changed Expand file tree Collapse file tree 5 files changed +53
-18
lines changed Original file line number Diff line number Diff line change 1
- import { useEffect , useRef , useState } from "react" ;
1
+ import { useEffect , useRef } from "react" ;
2
2
import "./App.css" ;
3
3
import { io } from "socket.io-client" ;
4
4
5
5
const socket = io ( "http://localhost:8000" ) ;
6
6
7
7
import Header from "./components/Header" ;
8
+ import Toolbar from "./components/Toolbar" ;
8
9
9
10
function App ( ) {
10
11
const canvasRef = useRef ( null ) ;
@@ -117,25 +118,12 @@ function App() {
117
118
< div id = "container" style = { { display : "flex" } } >
118
119
< div
119
120
id = "sidebar"
120
- className = "flex flex-col w-64 bg-gray-900 "
121
+ className = "flex flex-col w-64 bg-zinc-800 "
121
122
ref = { sidebarRef }
122
123
>
123
124
< Header > </ Header >
124
- < h1 id = "drawRTC" > drawRTC</ h1 >
125
- < div className = "input-container" id = "colorpicker" >
126
- < label htmlFor = "stroke" > Stroke</ label >
127
- < input id = "stroke" name = "stroke" type = "color" onChange = { addStroke } />
128
- </ div >
129
- < div className = "input-container" id = "linewidth" >
130
- < label htmlFor = "lineWidth" > Line Width</ label >
131
- < input
132
- id = "lineWidth"
133
- name = "lineWidth"
134
- type = "number"
135
- defaultValue = "3"
136
- onChange = { addLineWidth }
137
- />
138
- </ div >
125
+ < Toolbar > </ Toolbar >
126
+
139
127
< button id = "clear" onClick = { clearOnClick } >
140
128
Clear
141
129
</ button >
Original file line number Diff line number Diff line change
1
+ /* eslint-disable react/prop-types */
2
+ function ColorPicker ( props ) {
3
+ return (
4
+ < div className = "flex p-1 items-center justify-around" >
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-14 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 ColorPicker ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { FaBars } from "react-icons/fa";
2
2
3
3
function Header ( ) {
4
4
return (
5
- < div className = "flex border-b-2 py-5 justify-around bg-gradient-to-r from-indigo-500 from-10% via-sky-500 via-30% to-emerald-500 to-90% w-full items-center" >
5
+ < div className = "flex py-5 justify-around bg-gradient-to-r from-indigo-500 from-10% via-sky-500 via-30% to-emerald-500 to-90% w-full items-center" >
6
6
< h1 className = "font-sans text-2xl antialiased font-extrabold text-white" >
7
7
drawRTC
8
8
</ h1 >
Original file line number Diff line number Diff line change
1
+ function StrokeWidthPicker ( ) {
2
+ return (
3
+ < div className = "flex p-1 items-center justify-around" >
4
+ < h1 className = "font-sans text-lg antialiased font-semibold text-white" >
5
+ Stroke :
6
+ </ h1 >
7
+ < input
8
+ type = "number"
9
+ placeholder = "2"
10
+ defaultValue = { 2 }
11
+ className = "w-12 p-1 h-7 block border border-gray-800 cursor-pointer rounded-lg"
12
+ > </ input >
13
+ </ div >
14
+ ) ;
15
+ }
16
+
17
+ export default StrokeWidthPicker ;
Original file line number Diff line number Diff line change
1
+ import ColorPicker from "./ColorPicker" ;
2
+ import StrokeWidthPicker from "./StrokeWidthPicker" ;
3
+
4
+ function Toolbar ( ) {
5
+ return (
6
+ < div className = "block w-full mt-20" >
7
+ < ColorPicker name = "Colors :" defaultColor = "#000000" > </ ColorPicker >
8
+ < ColorPicker name = "Canvas :" defaultColor = "#FFFFFF" > </ ColorPicker >
9
+ < StrokeWidthPicker > </ StrokeWidthPicker >
10
+ </ div >
11
+ ) ;
12
+ }
13
+ export default Toolbar ;
You can’t perform that action at this time.
0 commit comments