Skip to content

Commit 4c076e9

Browse files
committed
make navbar not update when changing page and make it work on mobile
1 parent 8732573 commit 4c076e9

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

src/App.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { HashRouter, Routes, Route } from 'react-router'
22
import Home from './pages/Home.jsx'
33
import Projects from './pages/Projects.jsx'
4+
import Navbar from './components/Navbar.jsx'
45

56
function App() {
67
return (
78
<>
9+
<Navbar />
810
<HashRouter>
911
<Routes>
1012
<Route path="/" element={<Home />} />

src/components/Navbar.jsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
function Navbar() {
22
return (
33
<nav
4-
className="sticky top-4 z-10 mb-8 mx-auto w-[75%] sm:w-4/6
4+
className="sticky top-4 z-10 mb-8 mx-auto w-[75%]
55
bg-white/5 backdrop-blur-xs border border-white/15
66
rounded-full"
77
>
8-
<div className="flex justify-between items-center px-8 py-4 text-gray-200 text-lg font-extralight">
9-
<a
10-
href="#"
11-
className="font-light text-white tracking-wide hover:text-brand"
12-
>
13-
DFelipeh's Corner
14-
</a>
8+
<div className="flex justify-center sm:justify-between items-center px-8 py-4 text-gray-200 text-lg font-extralight">
9+
<div className="hidden sm:block">
10+
<a
11+
href="#"
12+
className="font-light text-white tracking-wide hover:text-brand"
13+
>
14+
DFelipeh's Corner
15+
</a>
16+
</div>
1517

16-
<div className="space-x-4 hidden sm:flex">
18+
<div className="space-x-4 flex">
1719
<a href="#" className="hover:text-brand">
1820
Home
1921
</a>

src/pages/Home.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import Navbar from '../components/Navbar'
44
function App() {
55
return (
66
<>
7-
<Navbar />
87
<div className="flex gap-2 items-center justify-center">
98
<h1 className="text-3xl text-center">
109
DFelipeh

src/pages/Projects.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import Navbar from '../components/Navbar'
33
function App() {
44
return (
55
<>
6-
<Navbar />
76
<div className="flex gap-2 items-center justify-center">
87
<h1 className="text-3xl text-center">
98
Projects page

0 commit comments

Comments
 (0)