Skip to content

Commit 9f369d5

Browse files
authored
Merge pull request #9 from apsinghdev/Feat/create-sidebar-UI
Feat/create sidebar UI
2 parents 1db9414 + 65f74b7 commit 9f369d5

File tree

10 files changed

+107
-29
lines changed

10 files changed

+107
-29
lines changed

client/package-lock.json

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"dependencies": {
1313
"react": "^18.2.0",
1414
"react-dom": "^18.2.0",
15+
"react-icons": "^5.2.0",
1516
"socket.io-client": "^4.7.4"
1617
},
1718
"devDependencies": {

client/src/App.css

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
21
#root {
32
height: 100vh;
43
width: 100vw;
54
}
65

7-
#sidebar * {
6+
/* #sidebar * {
87
margin-bottom: 6px;
9-
}
8+
} */
109

11-
#sidebar h1 {
10+
/* #sidebar h1 {
1211
margin-top: '20px';
1312
background: #7F7FD5;
1413
background: -webkit-linear-gradient(to right, #91EAE4, #86A8E7, #7F7FD5);
1514
background: linear-gradient(to right, #91EAE4, #86A8E7, #7F7FD5);
1615
background-clip: text;
1716
-webkit-background-clip: text;
1817
-webkit-text-fill-color: transparent;
19-
}
18+
} */
2019

2120
#linewidth{
2221
margin-top: 10px !important;
@@ -28,14 +27,14 @@
2827
width: 100%;
2928
}
3029

31-
#sidebar{
30+
/* #sidebar{
3231
display: flex;
3332
flex-direction: column;
3433
padding: 5px;
3534
width: 250px;
3635
background-color: #202020;
3736
padding-left: 15px;
38-
}
37+
} */
3938
.input-container {
4039
display: block;
4140
margin-top: 40px;

client/src/App.jsx

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
import { useEffect, useRef, useState } from "react";
1+
import { useEffect, useRef } from "react";
22
import "./App.css";
33
import { io } from "socket.io-client";
44

55
const socket = io("http://localhost:8000");
66

7+
import Header from "./components/Header";
8+
import Toolbar from "./components/Toolbar";
9+
710
function App() {
811
const canvasRef = useRef(null);
912
const sidebarRef = useRef(null);
@@ -113,27 +116,14 @@ function App() {
113116

114117
return (
115118
<div id="container" style={{ display: "flex" }}>
116-
<div id="sidebar" ref={sidebarRef}>
117-
<h1 id="drawRTC">drawRTC</h1>
118-
<div className="input-container" id="colorpicker">
119-
<label htmlFor="stroke">Stroke</label>
120-
<input
121-
id="stroke"
122-
name="stroke"
123-
type="color"
124-
onChange={addStroke}
125-
/>
126-
</div>
127-
<div className="input-container" id="linewidth">
128-
<label htmlFor="lineWidth">Line Width</label>
129-
<input
130-
id="lineWidth"
131-
name="lineWidth"
132-
type="number"
133-
defaultValue="3"
134-
onChange={addLineWidth}
135-
/>
136-
</div>
119+
<div
120+
id="sidebar"
121+
className="flex flex-col w-64 bg-zinc-800"
122+
ref={sidebarRef}
123+
>
124+
<Header></Header>
125+
<Toolbar></Toolbar>
126+
137127
<button id="clear" onClick={clearOnClick}>
138128
Clear
139129
</button>

client/src/components/ClearBtn.jsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function ClearBtn(){
2+
return (
3+
<div className="border block flex items-center justify-center mt-5">
4+
<button
5+
type="button"
6+
className="text-white bg-gradient-to-r from-red-400 via-red-500 to-red-600 hover:bg-gradient-to-br font-medium rounded-lg text-sm px-5 py-2.5 text-center"
7+
>
8+
Clear
9+
</button>
10+
</div>
11+
);
12+
}
13+
14+
export default ClearBtn;

client/src/components/ColorPicker.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 ColorPicker(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-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;

client/src/components/Header.jsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { FaBars } from "react-icons/fa";
2+
3+
function Header() {
4+
return (
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+
<h1 className="font-sans text-2xl antialiased font-extrabold text-white">
7+
drawRTC
8+
</h1>
9+
<div className="" id="options">
10+
<FaBars size={25} />
11+
</div>
12+
</div>
13+
);
14+
}
15+
16+
export default Header;

client/src/components/Socials.jsx

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
function StrokeWidthPicker(){
2+
return (
3+
<div className="flex p-1 items-center justify-around mt-4">
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-md"
12+
></input>
13+
</div>
14+
);
15+
}
16+
17+
export default StrokeWidthPicker;

client/src/components/Toolbar.jsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import ColorPicker from "./ColorPicker";
2+
import StrokeWidthPicker from "./StrokeWidthPicker";
3+
import ClearBtn from "./ClearBtn";
4+
5+
function Toolbar(){
6+
return (
7+
<div className="block w-full mt-20 border align-center">
8+
<ColorPicker name="Colors :" defaultColor="#000000"></ColorPicker>
9+
<ColorPicker name="Canvas :" defaultColor="#FFFFFF"></ColorPicker>
10+
<StrokeWidthPicker></StrokeWidthPicker>
11+
<ClearBtn></ClearBtn>
12+
</div>
13+
);
14+
}
15+
export default Toolbar;

0 commit comments

Comments
 (0)