summaryrefslogtreecommitdiff
path: root/front/src/root.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'front/src/root.jsx')
-rw-r--r--front/src/root.jsx47
1 files changed, 47 insertions, 0 deletions
diff --git a/front/src/root.jsx b/front/src/root.jsx
new file mode 100644
index 0000000..61f8615
--- /dev/null
+++ b/front/src/root.jsx
@@ -0,0 +1,47 @@
+import { Link, Outlet } from "react-router-dom";
+
+import logo from "./assets/chessh_sm.svg";
+
+import { useAuthContext } from "./context/auth_context";
+
+export const Root = () => {
+ const { signedIn, signOut } = useAuthContext();
+
+ return (
+ <>
+ <div className="container">
+ <div className="navbar">
+ <div className="flex-row-around">
+ <Link to="/home">
+ <img src={logo} className="logo" alt="CheSSH Logo" />
+ </Link>
+ </div>
+ <div className="nav">
+ {signedIn ? (
+ <>
+ <Link className="link" to="/password">
+ Password
+ </Link>
+ <Link className="link" to="/keys">
+ Keys
+ </Link>
+ <Link className="button" onClick={signOut} to="/">
+ Sign Out
+ </Link>
+ </>
+ ) : (
+ <>
+ <a href={process.env.REACT_APP_GITHUB_OAUTH} className="button">
+ 🐙 Login w/ GitHub 🐙
+ </a>
+ </>
+ )}
+ </div>
+ </div>
+ <div className="content">
+ <Outlet />
+ </div>
+ </div>
+ </>
+ );
+};