-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
78adc6f
commit 5b0d2e5
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { LOGO } from "../../RootImport.js"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { useSelector } from "react-redux"; | ||
|
||
const HomeNav = () => { | ||
const navigate = useNavigate(); | ||
const { token } = useSelector((state) => state.auth); | ||
|
||
return ( | ||
<> | ||
<nav className="bg-black shadow-md shadow-slate-100 w-full px-5 py-2 flex flex-row items-center justify-between mb-3"> | ||
<h1 | ||
className="flex flex-row items-center justify-between font-black cursor-pointer p-2 m-1 bg-white rounded-full text-slate-700 text-xl" | ||
onClick={() => { | ||
navigate("/"); | ||
}} | ||
> | ||
<img | ||
src={LOGO} | ||
alt="logo" | ||
width={40} | ||
height={40} | ||
className="w-11 h-auto rounded-full shadow-sm mx-1" | ||
/> | ||
Recyclez | ||
</h1> | ||
<div className="flex flex-row items-center justify-evenly mx-1"> | ||
{token ? ( | ||
<button | ||
type="button" | ||
onClick={() => { | ||
navigate("/user/dashboard"); | ||
}} | ||
className="px-2 py-3 rounded-full text-white hover:underline mx-1" | ||
> | ||
Dashboard | ||
</button> | ||
) : ( | ||
<button | ||
type="button" | ||
onClick={() => { | ||
navigate("/auth"); | ||
}} | ||
className="px-2 py-3 rounded-full text-white hover:underline mx-1" | ||
> | ||
Login | ||
</button> | ||
)} | ||
</div> | ||
</nav> | ||
</> | ||
); | ||
}; | ||
|
||
export default HomeNav; |