We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 02d06ab + 0383f14 commit b79acd7Copy full SHA for b79acd7
client/src/App.jsx
@@ -250,6 +250,17 @@ function App() {
250
}
251
}, []);
252
253
+ // Hook to hide the menu when user click elsewhere on the screen
254
+ useEffect(() => {
255
+ const canvas = document.getElementById("canvas");
256
+ canvas.addEventListener("click", () => {
257
+ console.log("clicked");
258
+ if (showMenu) {
259
+ setShowMenu(false);
260
+ }
261
+ })
262
+ }, [showMenu]);
263
+
264
return (
265
<div id="container">
266
<Sidebar
client/src/components/Canvas.jsx
@@ -11,6 +11,7 @@ function Canvas(props){
11
className="h-full w-86vw"
12
style={{backgroundColor: `${canvasColor}`}}
13
ref={props.canvasRef}
14
+ id="canvas"
15
></canvas>
16
{props.showMenu && <Menu></Menu>}
17
</div>
0 commit comments