Skip to content

Commit ea3bbcb

Browse files
committed
add canvas component
1 parent 359bb36 commit ea3bbcb

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

client/src/App.css

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,6 @@
5555
width: 60%;
5656
margin-top: 20px;
5757
}
58-
59-
.canvas-container {
60-
display: flex;
61-
justify-content: center;
62-
align-items: center;
63-
height: 100%;
64-
width: 100%;
65-
}
66-
67-
.canvas {
68-
height: 100%;
69-
width: 86vw;
70-
background-color: rgb(212, 212, 13);
71-
}
7258

7359

7460

client/src/App.jsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Toolbar from "./components/Toolbar";
99
import Socials from "./components/Socials";
1010
import LoginAndLogout from "./components/LoginAndLogout";
1111
import Sidebar from "./components/Sidebar";
12+
import Canvas from "./components/Canvas";
1213

1314
function App() {
1415
const canvasRef = useRef(null);
@@ -119,10 +120,12 @@ function App() {
119120

120121
return (
121122
<div id="container" style={{ display: "flex" }}>
122-
<Sidebar clearOnClick={clearOnClick} ref={sidebarRef} id="clear"></Sidebar>
123-
<div className="canvas-container">
124-
<canvas className="canvas" ref={canvasRef}></canvas>
125-
</div>
123+
<Sidebar
124+
clearOnClick={clearOnClick}
125+
ref={sidebarRef}
126+
id="clear"
127+
></Sidebar>
128+
<Canvas canvasRef={canvasRef}></Canvas>
126129
</div>
127130
);
128131
}

client/src/components/Canvas.jsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* eslint-disable react/prop-types */
2+
function Canvas(props){
3+
return (
4+
<div className="flex justify-center items-center h-full w-80vw overflow-hidden">
5+
<canvas
6+
className="h-full w-86vw bg-yellow-600"
7+
ref={props.canvasRef}
8+
></canvas>
9+
</div>
10+
);
11+
}
12+
13+
export default Canvas;

0 commit comments

Comments
 (0)