@@ -10,50 +10,104 @@ export function NavBar({ darkMode, toggleDarkMode }) {
1010 const { user } = useAuth ( ) ;
1111 const linkClass = ( { isActive } ) =>
1212 isActive
13- ? 'bg-light-green dark:bg-primary-green dark:hover:bg-primary-green rounded-xl px-3 py-2 p-4'
14- : 'hover:opacity-70 dark:hover:text-white rounded-xl px-3 py-2 p-4' ;
15-
13+ ? 'text-black bg-light-green dark:bg-primary-green dark:text-black rounded-xl px-3 py-2 p-4'
14+ : 'text-black dark:text-white hover:opacity-70 dark:hover:text-white rounded-xl px-3 py-2 p-4' ;
1615 return (
1716 < >
18- < header className = "bg-white dark:bg-black px-8 md:px-8 lg:px-20 pb-2 pt-[max(env(safe-area-inset-top),1rem)] text-center" >
19- { /* Desktop top nav */ }
20- < nav className = "hidden lg:flex items-center justify-between p-4" >
21- < div className = "w-full lg:w-auto text-center lg:text-left" >
17+ < div className = "max-w-[1200px] mx-auto" >
18+ < header className = "bg-white dark:bg-black px-8 md:px-8 lg:px-20 pb-2 pt-[max(env(safe-area-inset-top),1rem)] text-center" >
19+ { /* Desktop top nav */ }
20+ < nav className = "hidden lg:flex items-center justify-between p-4" >
21+ < div className = "w-full lg:w-auto text-center lg:text-left" >
22+ < NavLink to = "/" className = "Nav-link" >
23+ { darkMode ? (
24+ < img
25+ src = "/src/LOGO-white.png"
26+ alt = "GrocerEase logo"
27+ className = "w-[200px]"
28+ />
29+ ) : (
30+ < img
31+ src = "/src/LOGO-black.png"
32+ alt = "GrocerEase logo"
33+ className = "w-[200px]"
34+ />
35+ ) }
36+ </ NavLink >
37+ </ div >
38+ < div className = "flex items-center space-x-4" >
39+ { ! ! user && < p > Welcome, { user . displayName } </ p > }
40+ < NavLink to = "/" className = { linkClass } >
41+ < Button variant = "link" className = "text-base" >
42+ Home
43+ </ Button >
44+ </ NavLink >
45+
46+ < NavLink to = "/list" className = { linkClass } >
47+ < Button variant = "link" className = "text-base" >
48+ List
49+ </ Button >
50+ </ NavLink >
51+ < div className = " pt-2 pl-2" >
52+ { ! ! user ? (
53+ < abbr title = "Sign out" >
54+ < SignOutButton />
55+ </ abbr >
56+ ) : (
57+ < abbr title = "Sign in" >
58+ < SignInButton />
59+ </ abbr >
60+ ) }
61+ </ div >
62+ < Button
63+ onClick = { toggleDarkMode }
64+ className = "fixed w-16 bottom-16 right-16 p-2 rounded-full text-primary-pink hover:text-primary-pink hover:text-opacity-60 font-semibold"
65+ >
66+ < abbr
67+ title = {
68+ darkMode ? 'Switch to light mode' : 'Switch to dark mode'
69+ }
70+ >
71+ < button className = " rounded-full text-primary-pink hover:text-opacity-60" >
72+ { darkMode ? < Eclipse /> : < Sun /> }
73+ </ button >
74+ </ abbr >
75+ </ Button >
76+ </ div >
77+ </ nav >
78+
79+ { /* Mobile/Tablet bottom nav */ }
80+ < nav className = "flex lg:hidden items-center justify-between p-4" >
2281 < NavLink to = "/" className = "Nav-link" >
2382 { darkMode ? (
2483 < img
2584 src = "/src/LOGO-white.png"
2685 alt = "GrocerEase logo"
27- className = "w-[200px ]"
86+ className = "w-[170px ]"
2887 />
2988 ) : (
3089 < img
3190 src = "/src/LOGO-black.png"
3291 alt = "GrocerEase logo"
33- className = "w-[200px ]"
92+ className = "w-[170px ]"
3493 />
3594 ) }
3695 </ NavLink >
37- </ div >
38- < div className = "flex items-center space-x-4" >
39- { ! ! user && < p > Welcome, { user . displayName } </ p > }
40- < NavLink to = "/" className = { linkClass } >
96+ < div className = "flex items-center space-x-2" >
4197 < Button
42- variant = "link"
43- className = "text-black dark :text-white text-base "
98+ onClick = { toggleDarkMode }
99+ className = "p-2 text-primary-pink hover :text-opacity-60 rounded-full font-semibold "
44100 >
45- Home
46- </ Button >
47- </ NavLink >
48- < NavLink to = "/list" className = { linkClass } >
49- < Button
50- variant = "link"
51- className = "text-black dark:text-white text-base"
52- >
53- List
101+ < abbr
102+ title = {
103+ darkMode ? 'Switch to light mode' : 'Switch to dark mode'
104+ }
105+ >
106+ < button className = "px-2 rounded-full text-primary-pink hover:text-opacity-60" >
107+ { darkMode ? < Eclipse /> : < Sun /> }
108+ </ button >
109+ </ abbr >
54110 </ Button >
55- </ NavLink >
56- < div className = " pt-2" >
57111 { ! ! user ? (
58112 < abbr title = "Sign out" >
59113 < SignOutButton />
@@ -64,82 +118,24 @@ export function NavBar({ darkMode, toggleDarkMode }) {
64118 </ abbr >
65119 ) }
66120 </ div >
67- < Button
68- onClick = { toggleDarkMode }
69- className = "fixed w-16 bottom-16 right-16 p-2 rounded-full text-primary-pink hover:text-primary-pink hover:text-opacity-60 font-semibold"
70- >
71- < abbr
72- title = {
73- darkMode ? 'Switch to light mode' : 'Switch to dark mode'
74- }
75- >
76- < button className = " rounded-full text-primary-pink hover:text-opacity-60" >
77- { darkMode ? < Eclipse /> : < Sun /> }
78- </ button >
79- </ abbr >
80- </ Button >
81- </ div >
82- </ nav >
121+ </ nav >
122+ </ header >
83123
84- { /* Mobile/Tablet bottom nav */ }
85- < nav className = "flex lg:hidden items-center justify-between p-4" >
86- < NavLink to = "/" className = "Nav-link" >
87- { darkMode ? (
88- < img
89- src = "/src/LOGO-white.png"
90- alt = "GrocerEase logo"
91- className = "w-[170px]"
92- />
93- ) : (
94- < img
95- src = "/src/LOGO-black.png"
96- alt = "GrocerEase logo"
97- className = "w-[170px]"
98- />
99- ) }
100- </ NavLink >
101- < div className = "flex items-center space-x-2" >
102- { ! ! user ? (
103- < abbr title = "Sign out" >
104- < SignOutButton />
105- </ abbr >
106- ) : (
107- < abbr title = "Sign in" >
108- < SignInButton />
109- </ abbr >
110- ) }
111- < Button
112- onClick = { toggleDarkMode }
113- className = "p-2 text-primary-pink hover:text-opacity-60 rounded-full font-semibold"
114- >
115- < abbr
116- title = {
117- darkMode ? 'Switch to light mode' : 'Switch to dark mode'
118- }
119- >
120- < button className = "px-2 rounded-full text-primary-pink hover:text-opacity-60" >
121- { darkMode ? < Eclipse /> : < Sun /> }
122- </ button >
123- </ abbr >
124- </ Button >
124+ < nav className = "block z-10 lg:hidden fixed bottom-0 left-0 right-0 shadow-lg p-4 bg-white dark:bg-black" >
125+ < div className = "flex justify-around items-center" >
126+ < NavLink to = "/" className = { linkClass } >
127+ < Button className = "text-black dark:text-white text-base" >
128+ < House />
129+ </ Button >
130+ </ NavLink >
131+ < NavLink to = "/list" className = { linkClass } >
132+ < Button className = "text-black dark:text-white text-base" >
133+ < ListPlus />
134+ </ Button >
135+ </ NavLink >
125136 </ div >
126137 </ nav >
127- </ header >
128-
129- < nav className = "block lg:hidden fixed bottom-0 left-0 right-0 shadow-lg p-4 bg-white dark:bg-black" >
130- < div className = "flex justify-around items-center" >
131- < NavLink to = "/" className = { linkClass } >
132- < Button className = "text-black dark:text-white text-base" >
133- < House />
134- </ Button >
135- </ NavLink >
136- < NavLink to = "/list" className = { linkClass } >
137- < Button className = "text-black dark:text-white text-base" >
138- < ListPlus />
139- </ Button >
140- </ NavLink >
141- </ div >
142- </ nav >
138+ </ div >
143139 </ >
144140 ) ;
145141}
0 commit comments