-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLayout.jsx
More file actions
47 lines (35 loc) · 1.73 KB
/
Layout.jsx
File metadata and controls
47 lines (35 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { Outlet, Link, useLocation, useNavigate } from "react-router-dom";
import { useState, useEffect } from 'react';
const Layout = () => {
const [route, setRoute] = useState(0);
let location = useLocation().pathname
useEffect(() => {
setRoute(location)
})
let navigate = useNavigate();
return (
<div className="h-screen flex flex-col">
<div className="navbar fixed z-50 bg-secondary drag transition shadow-2xl">
<div className="dropdown dropdown-hover no-drag">
<label tabIndex={0} className="btn btn-ghost">
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M4 6h16M4 12h16M4 18h7" /></svg>
</label>
<ul tabIndex={0} className="menu menu-compact dropdown-content m-0 shadow bg-accent/50 backdrop-blur-md rounded-box w-48 no-drag">
<li><Link className="py-3" to={"/"}>Home</Link></li>
<li><Link className="py-3" to={"/settings"}>Settings</Link></li>
</ul>
</div>
<a className="btn btn-ghost normal-case text-xl text-shadow-white">bot.dev</a>
<p className="opacity-50">v0.1.2</p>
{route !== "/" &&
<div onClick={() => navigate(-1)} className="btn btn-ghost ml-5 no-drag">
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="white" viewBox="0 96 960 960" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M655 976 255 576l400-400 56 57-343 343 343 343-56 57Z" /></svg>
</div>
}
</div>
<div className="min-h-[64px] my-0 py-0"></div>
<Outlet />
</div>
);
};
export default Layout;