Skip to content

Commit 59283ea

Browse files
committed
add missing back button
1 parent c7add1d commit 59283ea

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

src/assets/App.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,25 @@ a {
531531
color: #99a2ac;
532532
}
533533

534+
.backToHome {
535+
display: flex;
536+
order: 4;
537+
width: 100%;
538+
}
539+
540+
.backToHome a {
541+
display: inline-flex;
542+
align-items: center;
543+
gap: 8px;
544+
font-size: 16px;
545+
vertical-align: middle;
546+
text-decoration: none;
547+
}
548+
549+
.backToHome a:hover {
550+
opacity: 0.7;
551+
}
552+
534553
.tags {
535554
display: flex;
536555
flex-wrap: wrap;

src/components/Layout/Header.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { BsFillBookmarksFill, BsFillGearFill, BsMoonFill } from 'react-icons/bs'
33
import { CgTab } from 'react-icons/cg'
44
import { IoMdSunny } from 'react-icons/io'
55
import { MdDoDisturbOff } from 'react-icons/md'
6-
import { Link, useNavigate } from 'react-router-dom'
6+
import { RxArrowLeft } from 'react-icons/rx'
7+
import { Link, useLocation, useNavigate } from 'react-router-dom'
78
import { ReactComponent as HackertabLogo } from 'src/assets/logo.svg'
89
import { SearchBar } from 'src/components/Elements/SearchBar'
910
import { UserTags } from 'src/components/Elements/UserTags'
@@ -17,6 +18,7 @@ export const Header = () => {
1718
const { theme, setTheme, setDNDDuration, isDNDModeActive } = useUserPreferences()
1819
const { userBookmarks } = useBookmarks()
1920
const navigate = useNavigate()
21+
const location = useLocation()
2022

2123
useEffect(() => {
2224
document.documentElement.classList.add(theme)
@@ -59,6 +61,8 @@ export const Header = () => {
5961
setDNDDuration('never')
6062
}
6163

64+
console.log('location', location)
65+
6266
return (
6367
<>
6468
<header className="AppHeader">
@@ -95,7 +99,15 @@ export const Header = () => {
9599
</>
96100
</Link>
97101
</div>
98-
<UserTags />
102+
{location.pathname === '/' ? (
103+
<UserTags />
104+
) : (
105+
<div className="backToHome">
106+
<Link to="/">
107+
<RxArrowLeft size={20} /> Back
108+
</Link>
109+
</div>
110+
)}
99111
</header>
100112
</>
101113
)

0 commit comments

Comments
 (0)