Skip to content

Commit

Permalink
Merge pull request #82 from the-collab-lab/kd-stylize-navbar
Browse files Browse the repository at this point in the history
[KD] Stylize Header and Navbar
  • Loading branch information
krsnamara committed Apr 6, 2024
2 parents 4e49aa3 + 1061235 commit f0d3651
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 29 deletions.
10 changes: 9 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand All @@ -11,6 +11,14 @@
content="A smart shopping list that learns your purchase habits and makes suggestions, so you don't forget to buy what's important."
/>
<link rel="icon" type="image/svg+xml" href="/src/favicon.ico" />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Righteous&display=swap"
/>
<link
href="https://fonts.googleapis.com/css2?family=Reddit+Mono:[email protected]&display=swap"
rel="stylesheet"
/>
<meta name="color-scheme" content="dark light" />
<title>Smart Shopping List</title>
<script type="module" src="/src/index.jsx" async></script>
Expand Down
3 changes: 1 addition & 2 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ body {
font-size: 1.8rem;
line-height: 1.4;
margin: 0;
margin-left: 10px;

-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
Expand Down Expand Up @@ -142,7 +141,7 @@ button {
background-color: var(--btn-bg-color-confirm);
border: 0;
border-radius: 20px;
color: var(--color-bg);
color: var(--color-white);
cursor: pointer;
font-size: 1.6rem;
font-family: 'Righteous', sans-serif;
Expand Down
97 changes: 86 additions & 11 deletions src/views/Layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,57 @@
}

.Layout-header {
background-color: var(--color-bg);
display: flex;
justify-content: space-between;
align-items: center;
background: var(--color-white);
padding-bottom: 0.5rem;
padding-top: max(env(safe-area-inset-top), 1rem);
text-align: center;
height: 55px;
}

.Layout-header > h1 {
.Layout-header-name {
margin: 0;
color: var(--color-branding);
font-size: 2rem;
font-family: 'Righteous', sans-serif;
text-decoration: none;
}

.Layout-header-login {
display: flex;
background-color: var(--btn-bg-color-confirm);
border-radius: 2rem;
max-width: 145px;
padding: 2px;
}

.Layout-header-login:hover {
background: var(--btn-bg-color-confirm-hover);
}

.Layout-header-signed-in {
display: flex;
justify-content: center;
align-items: center;
}

.Layout-header-profile {
border-radius: 50%;
border: 1px solid transparent;
width: 40px;
}

.Layout-header button {
background: transparent;
border: none;
margin: 0;
cursor: pointer;
}

.Layout-header button:hover {
background: var(--btn-bg-color-confirm-hover);
}

.Layout-main {
Expand All @@ -39,26 +82,26 @@
background-color: var(--color-bg);
border-top: 1px solid var(--color-border);
display: flex;
flex-direction: row;
flex-direction: column;
padding-bottom: max(env(safe-area-inset-bottom), 1rem);
padding-top: 1rem;
place-content: center;
position: fixed;
width: 100%;
background: var(--color-branding);
max-height: 42px;
}

.Nav-container {
display: flex;
flex-direction: row;
justify-content: space-evenly;
width: min(72ch, 100%);
justify-content: space-between;
}

.Nav-link {
--color-text: var(--color-accent);

color: var(--color-text);
font-size: 1.4em;
color: var(--color-accent);
text-decoration: none;
font-family: 'Righteous', sans-serif;
color: white;
font-size: 2rem;
flex: 0 1 auto;
line-height: 1;
padding: 0.8rem;
Expand All @@ -67,6 +110,7 @@
}

.Nav-link.active {
text-decoration: underline;
text-decoration-thickness: 0.22em;
text-underline-offset: 0.1em;
}
Expand Down Expand Up @@ -98,3 +142,34 @@
.Layout-footer-link:hover {
color: var(--color-accent);
}

@media only screen and (max-width: 500px) {
.Layout-header {
height: 70px;
}
.Layout-header-name {
display: inline-flex;
font-size: 1.45rem;
}

.Layout-header-login {
width: 110px;
}

.Layout-header-profile {
width: 32px;
}

.Layout-header button {
font-size: 1.4rem;
padding: 0;
}

.Layout-header-signed-in {
gap: 6px;
}

.Nav-link {
font-size: 1.8rem;
}
}
37 changes: 22 additions & 15 deletions src/views/Layout.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Outlet, NavLink } from 'react-router-dom';
import { Outlet, NavLink, Link } from 'react-router-dom';
import { useAuth, SignInButton, SignOutButton } from '../api/useAuth.jsx';
import { Emoji } from '../components';
import './Layout.css';
Expand All @@ -11,26 +11,34 @@ export function Layout() {
<>
<div className="Layout">
<header className="Layout-header">
<h1>Smart shopping list</h1>
{!!user ? (
<div>
<span>Signed in as {auth.currentUser.displayName}</span> (
<SignOutButton />)
</div>
) : (
<SignInButton />
)}
<Link to="/" className="Layout-header-name">
<h1>Aisle Be There</h1>
</Link>
<div className="Layout-header-login">
{!!user ? (
<div className="Layout-header-signed-in">
<img
src={auth.currentUser.photoURL}
alt="user"
className="Layout-header-profile"
/>
<SignOutButton />
</div>
) : (
<SignInButton />
)}
</div>
</header>
<nav className="Nav">
<div className="Nav-container">
<NavLink to="/" className="Nav-link">
Home
home
</NavLink>
<NavLink to="/list" className="Nav-link">
List
lists
</NavLink>
<NavLink to="/about" className="Nav-link">
About
about
</NavLink>
</div>
</nav>
Expand All @@ -39,8 +47,7 @@ export function Layout() {
</main>
<footer className="Layout-footer">
<p className="Layout-footer-attribution">
Crafted with care <Emoji label="purple-heart">💜</Emoji>
{' '}by{' '}
Crafted with care <Emoji label="purple-heart">💜</Emoji> by{' '}
<a
className="Layout-footer-link"
href="https://github.com/amalyam"
Expand Down

0 comments on commit f0d3651

Please sign in to comment.