File tree Expand file tree Collapse file tree 5 files changed +19
-5
lines changed Expand file tree Collapse file tree 5 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 1
- import { useEffect , useRef } from "react" ;
1
+ import { useEffect , useRef , useState } 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 Sidebar from "./components/Sidebar" ;
8
8
import Canvas from "./components/Canvas" ;
9
+ import Menu from "./components/Menu" ;
9
10
10
11
function App ( ) {
12
+
13
+ const [ showMenu , setShowMenu ] = useState ( false ) ;
14
+
15
+ function toggleMenu ( ) {
16
+ setShowMenu ( ! showMenu ) ;
17
+ }
18
+
11
19
const canvasRef = useRef ( null ) ;
12
20
const sidebarRef = useRef ( null ) ;
13
21
let color = '#000000'
@@ -120,8 +128,10 @@ function App() {
120
128
clearOnClick = { clearOnClick }
121
129
ref = { sidebarRef }
122
130
id = "clear"
131
+ toggleMenu = { toggleMenu }
123
132
> </ Sidebar >
124
133
< Canvas canvasRef = { canvasRef } > </ Canvas >
134
+ { showMenu && < Menu > </ Menu > }
125
135
</ div >
126
136
) ;
127
137
}
Original file line number Diff line number Diff line change 1
1
/* eslint-disable react/prop-types */
2
+ import Menu from "./Menu" ;
3
+
2
4
function Canvas ( props ) {
3
5
return (
4
6
< div className = "flex justify-center items-center h-full w-80vw overflow-hidden" >
5
7
< canvas
6
8
className = "h-full w-86vw bg-yellow-600"
7
9
ref = { props . canvasRef }
8
10
> </ canvas >
11
+ { props . showMenu && < Menu > </ Menu > }
9
12
</ div >
10
13
) ;
11
14
}
Original file line number Diff line number Diff line change
1
+ /* eslint-disable react/prop-types */
1
2
import { FaBars } from "react-icons/fa" ;
2
3
3
- function Header ( ) {
4
+ function Header ( props ) {
4
5
return (
5
6
< 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
7
< h1 className = "font-sans text-2xl antialiased font-extrabold text-white" >
7
8
drawRTC
8
9
</ h1 >
9
10
< div className = "" id = "options" >
10
- < FaBars size = { 25 } />
11
+ < FaBars size = { 25 } onClick = { props . toggleMenu } />
11
12
</ div >
12
13
</ div >
13
14
) ;
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import Socials from "./Socials";
3
3
4
4
function Menu ( ) {
5
5
return (
6
- < div className = "w-20 h-auto bg-white z-100 " >
6
+ < div className = "w-52 h-56 bg-green-500 absolute left-52 top-8 rounded-lg shadow-xl " >
7
7
< MenuItem feat = "Start Collaboration" > </ MenuItem >
8
8
< MenuItem feat = "Start Chat" > </ MenuItem >
9
9
< MenuItem feat = "Save as pdf" > </ MenuItem >
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import LoginAndLogout from "./LoginAndLogout";
6
6
function Sidebar ( props ) {
7
7
return (
8
8
< div className = "flex flex-col w-64 bg-zinc-800 relative" ref = { props . ref } >
9
- < Header > </ Header >
9
+ < Header toggleMenu = { props . toggleMenu } > </ Header >
10
10
< Toolbar clearOnClick = { props . clearOnClick } id = { props . id } > </ Toolbar >
11
11
< LoginAndLogout > </ LoginAndLogout >
12
12
</ div >
You can’t perform that action at this time.
0 commit comments