Skip to content

Commit 4b66e95

Browse files
committed
fix: slight changes for mobile navbar
1 parent 6af01ca commit 4b66e95

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

components/Navbar.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
import { SiSqlite, SiGithub } from "react-icons/si";
22
import { FaFileCsv, FaHome } from "react-icons/fa";
3+
import { useState, useEffect } from "react";
34

45
const Navbar: React.FC = () => {
6+
const [isMobile, setIsMobile] = useState(false);
7+
8+
useEffect(() => {
9+
const handleResize = () => {
10+
setIsMobile(window.innerWidth <= 770);
11+
};
12+
13+
window.addEventListener("resize", handleResize);
14+
handleResize();
15+
16+
return () => window.removeEventListener("resize", handleResize);
17+
}, []);
18+
519
return (
620
<header className="bg-gray-800 text-white w-full mb-4">
721
<div className="container mx-auto flex justify-between items-center p-4">
822
<div className="flex items-center gap-4">
923
<h1 className="text-2xl font-semibold flex items-center gap-2">
1024
<SiSqlite />
11-
SQLite Reader
25+
{!isMobile && "SQLite Reader"}
1226
</h1>
1327
<a
1428
className="px-4 py-2 rounded hover:bg-blue-600 transition inline-flex items-center gap-2"
@@ -17,6 +31,7 @@ const Navbar: React.FC = () => {
1731
backgroundColor: "var(--button-bg)",
1832
color: "var(--button-text-color)",
1933
}}
34+
title="Home"
2035
>
2136
<FaHome />
2237
Home
@@ -28,6 +43,7 @@ const Navbar: React.FC = () => {
2843
backgroundColor: "var(--button-bg)",
2944
color: "var(--button-text-color)",
3045
}}
46+
title="Convert"
3147
>
3248
<FaFileCsv />
3349
Convert
@@ -41,9 +57,10 @@ const Navbar: React.FC = () => {
4157
color: "var(--button-text-color)",
4258
}}
4359
target="_blank"
60+
title="GitHub"
4461
>
4562
<SiGithub />
46-
View on GitHub
63+
{isMobile ? "GitHub" : "View on GitHub"}
4764
</a>
4865
</div>
4966
</div>

0 commit comments

Comments
 (0)