File tree 2 files changed +23
-1
lines changed
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+
3
+ const Link = ( { children, to} ) => {
4
+
5
+ const navigate = ( event ) => {
6
+ event . preventDefault ( )
7
+ window . history . pushState ( null , null , to )
8
+ window . dispatchEvent ( new PopStateEvent ( 'popstate' ) )
9
+ }
10
+
11
+ return (
12
+ < a onClick = { navigate } href = { to } >
13
+ { children }
14
+ </ a >
15
+ )
16
+ }
17
+
18
+ export default Link
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ import './Navbar.css'
3
3
import BrandLogo from '../../../assets/logos/BrandLogo' ;
4
4
import DashboardForm from '../../Dashboard/DashboardForm/DashboardForm' ;
5
5
import { LoginContext } from '../../../contexts/LoginContext' ;
6
+ import Link from '../../Link' ;
7
+
6
8
7
9
const Navbar = ( ) => {
8
10
@@ -12,7 +14,9 @@ const Navbar = () => {
12
14
< nav className = "navbar navbar-dark py-3" >
13
15
< div className = "container" >
14
16
< span className = "navbar-brand" >
15
- < BrandLogo />
17
+ < Link to = { isLoggedIn ? '/search-screen' : '/' } >
18
+ < BrandLogo />
19
+ </ Link >
16
20
</ span >
17
21
{
18
22
isLoggedIn &&
You can’t perform that action at this time.
0 commit comments