Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Mohammad Dwikurnia Apriadi
Diskuy-Frontend
Commits
0bfaefc9
Commit
0bfaefc9
authored
Feb 25, 2021
by
Jonathan Chandra
Browse files
use NavLink on navbar and edit styling for navbar menu
parent
a7f66865
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/components/utility/Navbar.jsx
View file @
0bfaefc9
...
...
@@ -4,10 +4,10 @@ import '../../styles/utility/Navbar.css';
import
AuthService
,
{
loggedIn
}
from
'
../../helpers/services/auth.service
'
;
import
{
useInput
}
from
'
../../helpers/hooks/input-hook
'
;
import
{
Link
,
withRouter
}
from
'
react-router-dom
'
;
import
{
NavLink
}
from
'
react-router-dom
'
;
const
Navbar
=
(
props
)
=>
{
const
{
value
:
search
,
bind
:
bindSearch
,
reset
:
resetSearch
}
=
useInput
(
''
);
const
handleLogout
=
()
=>
{
AuthService
.
logout
();
window
.
location
.
reload
();
...
...
@@ -58,36 +58,58 @@ const Navbar = (props) => {
</
form
>
<
ul
className
=
"navbar-nav ml-auto"
>
<
li
className
=
"nav-item mr-auto"
>
<
Link
to
=
"/page/1"
className
=
"nav-link"
>
<
NavLink
exact
activeClassName
=
"navbar--active"
className
=
"nav-link"
to
=
"/page/1"
>
<
b
>
Threads
</
b
>
</
Link
>
</
Nav
Link
>
</
li
>
<
li
className
=
"nav-item mr-auto"
>
<
Link
to
=
"/topic"
className
=
"nav-link"
>
<
NavLink
exact
activeClassName
=
"navbar--active"
className
=
"nav-link"
to
=
"/topic"
>
<
b
>
Topics
</
b
>
</
Link
>
</
Nav
Link
>
</
li
>
{
loggedIn
&&
(
<
li
className
=
"nav-item mr-auto"
>
<
Link
to
=
{
`/profile/
${
AuthService
.
getCurrentUsername
()}
/1`
}
<
NavLink
exact
activeClassName
=
"navbar--active"
className
=
"nav-link"
to
=
{
`/profile/
${
AuthService
.
getCurrentUsername
()}
/page/1`
}
>
<
b
>
Profile
</
b
>
</
Link
>
</
Nav
Link
>
</
li
>
)
}
{
loggedIn
?
(
<
li
className
=
"nav-item mr-auto"
onClick
=
{
handleLogout
}
>
<
Link
to
=
"/login"
className
=
"nav-link"
>
<
NavLink
exact
activeClassName
=
"navbar--active"
className
=
"nav-link"
to
=
"/login"
>
<
b
>
Logout
</
b
>
</
Link
>
</
Nav
Link
>
</
li
>
)
:
(
<
li
className
=
"nav-item mr-auto"
>
<
Link
to
=
"/login"
className
=
"nav-link"
>
<
NavLink
exact
activeClassName
=
"navbar--active"
className
=
"nav-link"
to
=
"/login"
>
<
b
>
Login
</
b
>
</
Link
>
</
Nav
Link
>
</
li
>
)
}
</
ul
>
...
...
src/styles/utility/Navbar.css
View file @
0bfaefc9
...
...
@@ -8,6 +8,10 @@
transition
:
0.4s
;
}
.nav-link
:hover
{
color
:
#DE6600
!important
;
}
.navbar-toggler
{
padding
:
0px
;
line-height
:
0px
;
...
...
@@ -50,6 +54,10 @@
color
:
#ffffff
!important
;
}
.navbar--active
{
color
:
#DE6600
!important
;
}
@media
only
screen
and
(
min-device-width
:
320px
)
and
(
max-device-width
:
480px
)
{
.form-control
{
min-width
:
180px
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment