Skip to content

Instantly share code, notes, and snippets.

@Taofiqq
Last active August 2, 2022 02:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Taofiqq/5fe986309bf2bdbf7eb7edd4249960cd to your computer and use it in GitHub Desktop.
Save Taofiqq/5fe986309bf2bdbf7eb7edd4249960cd to your computer and use it in GitHub Desktop.
Navbar and Footer Component
import Link from "next/link";
import styles from "../styles/Navbar.module.css";
import { supabase } from "../utils/supabase";
const Navbar = ({ session }) => {
return (
<div className={styles.container}>
<div>
<p className={styles.title}>Adrenargy</p>
</div>
{session?.user ? (
<ul className={styles.navContent}>
<Link href="/">
<li className={styles.name}>Home</li>
</Link>
<button
className={styles.buttons}
onClick={() => supabase.auth.signOut()}
>
Logout
</button>
<Link href="/create">
<button className={styles.buttons}>Create New Workout</button>
</Link>
</ul>
) : (
<ul className={styles.navContent}>
<Link href="/login">
<li className={styles.buttons}>Login</li>
</Link>
<Link href="/signup">
<li className={styles.buttons}>Signup</li>
</Link>
</ul>
)}
</div>
);
};
export default Navbar;
.container {
color: #d8d8d8;
display: flex;
justify-content: space-between;
align-items: center;
padding: 2rem 3rem;
}
.navContent {
display: flex;
align-items: center;
}
.title {
font-size: 1.5rem;
font-weight: 500;
}
.name {
margin-right: 2rem;
color: #f35815;
cursor: pointer;
}
.buttons {
border: 1px solid #f35815;
background-color: transparent;
color: #d8d8d8;
padding: 0.5rem 2rem;
border-radius: 0.4rem;
cursor: pointer;
transition: all 0.3s ease-in-out;
margin-right: 1.5rem;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment