Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sm dg style header navigation #62

Merged
merged 5 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/img/basket-buddy-logo.png
DevinaG007 marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion src/api/useAuth.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ export const SignInButton = () => (
* A button that signs the user out of the app using Firebase Auth.
*/
export const SignOutButton = () => (
<button type="button" onClick={() => auth.signOut()}>
<button
className=" bg-pale-green rounded-lg px-3 py-1 border-2 border-sage text-off-black"
type="button"
onClick={() => auth.signOut()}
>
Sign Out
</button>
);
Expand Down
1 change: 0 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ html {

body {
background-color: var(--color-bg);
color: var(--color-text);
font-family:
-apple-system,
BlinkMacSystemFont,
Expand Down
42 changes: 30 additions & 12 deletions src/views/Layout.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
import { Outlet, NavLink } from 'react-router-dom';
import { IoHome, IoList, IoCreate } from 'react-icons/io5';

import './Layout.css';
import { auth } from '../api/config.js';
import { useAuth, SignInButton, SignOutButton } from '../api/useAuth.jsx';
import buddyLogo from '../../public/img/basket-buddy-logo.png';

export function Layout() {
const { user } = useAuth();
const activeLink =
'Nav-link text-sage border-2 border-sage rounded-full bg-eggshell';
const link =
'Nav-link text-eggshell border-2 rounded-full border-vanilla hover:text-sage hover:border-sage';
DevinaG007 marked this conversation as resolved.
Show resolved Hide resolved
return (
<>
<div className="Layout">
<header className="Layout-header">
<h1>Smart shopping list</h1>
<header
className="Layout-header flex flex-col items-center bg-eggshell
text-off-black"
>
<img className="md:w-1/3" src={buddyLogo} alt="Basket Buddy" />
{!!user ? (
<div>
<span>Signed in as {auth.currentUser.displayName}</span> (
<SignOutButton />)
<span>Signed in as {auth.currentUser.displayName}</span>
<SignOutButton />
</div>
) : (
<SignInButton />
Expand All @@ -23,16 +32,25 @@ export function Layout() {
<main className="Layout-main">
<Outlet />
</main>
<nav className="Nav">
<div className="Nav-container">
<NavLink to="/" className="Nav-link">
Home
<nav className="Nav bg-brown">
<div className="Nav-container flex flex-row justify-around">
<NavLink
to="/"
className={({ isActive }) => (isActive ? activeLink : link)}
>
<IoHome alt="Home" />
</NavLink>
<NavLink to="/list" className="Nav-link">
List
<NavLink
to="/list"
className={({ isActive }) => (isActive ? activeLink : link)}
>
<IoList alt="List" />
</NavLink>
<NavLink to="/manage-list" className="Nav-link">
Manage List
<NavLink
to="/manage-list"
className={({ isActive }) => (isActive ? activeLink : link)}
>
<IoCreate alt="Manage List" />
</NavLink>
</div>
</nav>
Expand Down
1 change: 1 addition & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default {
yellow: '#FEFAE0',
vanilla: '#FAEDCD',
'pale-green': '#E9EDC9',
'off-black': '#353839',
},
extend: {
fontFamily: {
Expand Down