Skip to content

Commit

Permalink
more nav cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
meixingc committed Mar 24, 2023
1 parent 4ac0248 commit 0deb0e8
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions client/src/components/Nav.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { useNavigate, Link } from 'react-router-dom'
import { useContext } from 'react'
import { DataContext } from '../DataContext'

import SearchBar from '../pages/SearchBar'

export default function Nav() {
let navigate = useNavigate()
const {authenticated, toggleAuthenticated} = useContext(DataContext)

return (
<div className="nav">
<div className='nav-left'>
<SearchBar />
</div>
<div className="nav-center">
<img className="logo" src="/rhythmic.png"/>
<div className="center-bottom">
{
(!authenticated) ? <button className="registerbtn" onClick={() => navigate('/register')}> What's Your Rhythm? </button> : null
}
</div>
</div>
<div className='nav-right'>
<Link to='/' className='nav-right-buttons'> Home </Link>
<Link to='/profile'className='nav-right-buttons'> Profile </Link>
{
(!authenticated) ? <Link to='/signin' className='nav-right-buttons'> Sign in </Link> : <Link to='/signin' className='nav-right-buttons' onClick={() => toggleAuthenticated(false)}> Sign out </Link>
}
</div>
</div>
)
}

0 comments on commit 0deb0e8

Please sign in to comment.