Skip to content

Commit a144a2b

Browse files
18. As a user, I want the navbar to be on the top of the page #34 (#37)
* updated the css for the navbar, app title, and user info * changed icon link * final changes
1 parent 9c996f7 commit a144a2b

File tree

4 files changed

+63
-28
lines changed

4 files changed

+63
-28
lines changed

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
name="description"
1111
content="A smart shopping list that learns your purchase habits and makes suggestions, so you don't forget to buy what's important."
1212
/>
13-
<link rel="icon" type="image/svg+xml" href="/src/favicon.ico" />
13+
<link rel="icon" type="image/svg+xml" href="/public/app-icon.svg" />
1414
<link rel="preconnect" href="https://fonts.googleapis.com" />
1515
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
1616
<link

public/app-icon.svg

+12
Loading

src/views/Layout.css

+23-9
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,28 @@
1414
}
1515

1616
.Layout > * {
17-
padding-inline: min(5dvw, 3.2rem);
1817
}
1918

2019
.Layout-header {
2120
background-color: var(--color-bg);
22-
padding-bottom: 0.5rem;
23-
padding-top: max(env(safe-area-inset-top), 1rem);
2421
text-align: center;
22+
background-color: #e7eaf6;
2523
}
2624

27-
.Layout-header > h1 {
25+
.Layout-header > .login-user {
26+
padding: 15px 30px;
27+
}
28+
29+
.Layout-header > .Layout-title {
30+
display: flex;
31+
justify-content: center;
32+
align-items: center;
33+
gap: 30px;
2834
margin: 0;
35+
font-size: 50px;
36+
color: #113f67;
37+
padding: 0 30px 30px;
38+
border-bottom: 1px solid var(--color-border);
2939
}
3040

3141
.Layout-main {
@@ -36,15 +46,14 @@
3646
}
3747

3848
.Nav {
39-
background-color: var(--color-bg);
49+
background-color: #113f67;
4050
border-top: 1px solid var(--color-border);
41-
bottom: 0;
4251
display: flex;
4352
flex-direction: row;
4453
padding-bottom: max(env(safe-area-inset-bottom), 1rem);
4554
padding-top: 1rem;
55+
margin-bottom: 4rem;
4656
place-content: center;
47-
position: fixed;
4857
width: 100%;
4958
}
5059

@@ -56,8 +65,7 @@
5665
}
5766

5867
.Nav-link {
59-
--color-text: var(--color-accent);
60-
68+
--color-text: #e7eaf6;
6169
color: var(--color-text);
6270
font-size: 1.4em;
6371
flex: 0 1 auto;
@@ -67,7 +75,13 @@
6775
text-underline-offset: 0.1em;
6876
}
6977

78+
.Nav-link:hover {
79+
color: #e69500;
80+
transition: all 0.3s ease-in-out;
81+
}
82+
7083
.Nav-link.active {
84+
color: #e69500;
7185
text-decoration-thickness: 0.22em;
7286
text-underline-offset: 0.1em;
7387
}

src/views/Layout.jsx

+27-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Outlet } from 'react-router-dom';
22

33
import './Layout.css';
4+
import { FaShoppingBag, FaUser, FaUserMinus } from 'react-icons/fa';
45
import { auth } from '../api/config.js';
56
import { SignInButton, SignOutButton, useAuth } from '../api/useAuth.jsx';
67
import { NavLink } from 'react-router-dom';
@@ -20,24 +21,27 @@ export function Layout() {
2021
<>
2122
<div className="Layout">
2223
<header className="Layout-header">
23-
<h1>Smart shopping list</h1>
24-
{!user ? (
25-
<div>
26-
<SignInButton />
27-
</div>
28-
) : (
29-
<div>
30-
<span>{user?.displayName}</span>
31-
<SignOutButton />
32-
</div>
33-
)}
24+
<div className="login-user">
25+
{!user ? (
26+
<div className="flex justify-end gap-5 items-center">
27+
<FaUser />
28+
<SignInButton />
29+
</div>
30+
) : (
31+
<div className="flex justify-between">
32+
<span>Welcome {user?.displayName}!</span>
33+
<span className="flex justify-end gap-5 items-center">
34+
<FaUserMinus />
35+
<SignOutButton />
36+
</span>
37+
</div>
38+
)}
39+
</div>
40+
<div className="Layout-title">
41+
<FaShoppingBag />
42+
<h1>Smart Shopping List</h1>
43+
</div>
3444
</header>
35-
<main className="Layout-main">
36-
<h1 className="my-3 text-center font-extrabold text-4xl">
37-
{localStorage.getItem('list') || 'No list selected'}
38-
</h1>
39-
<Outlet />
40-
</main>
4145
<nav className="Nav">
4246
<div className="Nav-container">
4347
<NavLink to="/" className="Nav-link">
@@ -51,7 +55,12 @@ export function Layout() {
5155
</NavLink>
5256
</div>
5357
</nav>
54-
</div>
58+
<main className="Layout-main">
59+
<h1 className="my-3 text-center font-extrabold text-4xl">
60+
{localStorage.getItem('list') || 'No list selected'}
61+
</h1>
62+
<Outlet />
63+
</main>
5564
</>
5665
);
5766
}

0 commit comments

Comments
 (0)