Skip to content

Commit 057795d

Browse files
committed
add back button in CV page
1 parent caf0ec3 commit 057795d

File tree

4 files changed

+49
-26
lines changed

4 files changed

+49
-26
lines changed

v2/src/components/navbar/navbar.tsx

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
import {useState, useEffect} from "react";
2-
import {Menu, X, Home, FileText, Briefcase, Code, Award, GraduationCap, Mail, FileUser} from "lucide-react";
1+
import {useEffect, useState} from "react";
2+
import {Award, Briefcase, Code, FileText, GraduationCap, Home, Mail, Menu, X} from "lucide-react";
33
import styles from "./navbar.module.css";
44

55
interface NavbarProps {
66
onNavigateToContact?: () => void;
77
onNavigateToCV?: () => void;
8+
currentPage?: string;
89
}
910

10-
export function Navbar({onNavigateToContact, onNavigateToCV}: NavbarProps = {}) {
11+
export function Navbar({onNavigateToContact, onNavigateToCV, currentPage}: NavbarProps = {}) {
1112
const [isScrolled, setIsScrolled] = useState(false);
1213
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
1314
const [activeSection, setActiveSection] = useState("hero");
@@ -17,15 +18,15 @@ export function Navbar({onNavigateToContact, onNavigateToCV}: NavbarProps = {})
1718
setIsScrolled(window.scrollY > 50);
1819

1920
// Determine active section based on scroll position
20-
const sections = ["hero", "overview", "skills", "experience", 'project', "education", "awards", "contact"];
21+
const sections = ["hero", "overview", "skills", "experience", 'project', "education", "awards", "contact", "cv"];
2122
const scrollPosition = window.scrollY + window.innerHeight / 2;
2223
const documentHeight = document.documentElement.scrollHeight;
2324
const windowHeight = window.innerHeight;
2425
const scrollBottom = window.scrollY + windowHeight;
2526

2627
// Check if we're near the bottom of the page (within 200px)
27-
if (documentHeight - scrollBottom < 200) {
28-
setActiveSection("contact");
28+
if (currentPage === 'cv') {
29+
setActiveSection("cv");
2930
return;
3031
}
3132

@@ -69,6 +70,7 @@ export function Navbar({onNavigateToContact, onNavigateToCV}: NavbarProps = {})
6970
{id: "education", label: "Education", icon: GraduationCap},
7071
{id: "awards", label: "Awards", icon: Award},
7172
{id: "contact", label: "Contact", icon: Mail},
73+
{id: "cv", label: "CV", icon: FileText},
7274
];
7375

7476
const handleContactClick = () => {
@@ -90,7 +92,7 @@ export function Navbar({onNavigateToContact, onNavigateToCV}: NavbarProps = {})
9092
return (
9193
<nav className={`${styles.navbar} ${isScrolled ? styles.scrolled : ""}`}>
9294
<div className={styles.navContainer}>
93-
{isScrolled || onNavigateToCV ? (
95+
{isScrolled ? (
9496
<button className={styles.logo} onClick={() => scrollToSection("hero")}>
9597
<span className={styles.logoText}>Towfiqul Islam</span>
9698
<span className={styles.logoSubtext}>Senior Software Engineer</span>
@@ -100,21 +102,26 @@ export function Navbar({onNavigateToContact, onNavigateToCV}: NavbarProps = {})
100102
<span className={styles.logoText}></span>
101103
<span className={styles.logoSubtext}></span>
102104
</button>
103-
)
104-
}
105+
)}
105106

106107
<div className={`${styles.navLinks} ${isMobileMenuOpen ? styles.mobileOpen : ""}`}>
107108
{navItems.map((item) => {
108109
const Icon = item.icon;
109110
return (
110-
<button
111-
key={item.id}
112-
onClick={() => scrollToSection(item.id)}
113-
className={`${styles.navLink} ${activeSection === item.id ? styles.active : ""}`}
114-
>
115-
<Icon className={styles.navIcon}/>
116-
<span>{item.label}</span>
117-
</button>
111+
item.id === 'cv' ?
112+
(<button onClick={handleCVClick}
113+
className={`${styles.navLink} ${activeSection === "cv" ? styles.active : ""}`}>
114+
<FileText className={styles.navIcon}/>
115+
<span>CV</span>
116+
</button>) :
117+
(<button
118+
key={item.id}
119+
onClick={() => scrollToSection(item.id)}
120+
className={`${styles.navLink} ${activeSection === item.id ? styles.active : ""}`}
121+
>
122+
<Icon className={styles.navIcon}/>
123+
<span>{item.label}</span>
124+
</button>)
118125
);
119126
})}
120127
{/*<button*/}
@@ -124,12 +131,6 @@ export function Navbar({onNavigateToContact, onNavigateToCV}: NavbarProps = {})
124131
{/* <Mail className={styles.navIcon}/>*/}
125132
{/* <span>Contact</span>*/}
126133
{/*</button>*/}
127-
{onNavigateToCV && (
128-
<button onClick={handleCVClick} className={styles.navLink}>
129-
<FileUser className={styles.navIcon}/>
130-
<span>CV</span>
131-
</button>
132-
)}
133134
</div>
134135

135136
<button

v2/src/pages/CV.module.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
align-items: center;
1313
}
1414

15+
.backButton {
16+
position: fixed;
17+
top: calc(30px + var(--space-4));
18+
right: var(--space-6);
19+
z-index: 100;
20+
gap: var(--space-2);
21+
box-shadow: var(--shadow-3);
22+
}
23+
1524
.downloadButton {
1625
position: fixed;
1726
top: calc(70px + var(--space-4));
@@ -328,6 +337,13 @@
328337

329338
/* Responsive */
330339
@media (max-width: 768px) {
340+
.backButton {
341+
top: calc(30px + var(--space-3));
342+
right: var(--space-4);
343+
font-size: 0.875rem;
344+
padding: var(--space-2) var(--space-3);
345+
}
346+
331347
.downloadButton {
332348
top: calc(60px + var(--space-3));
333349
right: var(--space-4);

v2/src/pages/CV.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Download } from "lucide-react";
1+
import {ArrowLeft, Download} from "lucide-react";
22
import { useRef } from "react";
33
import html2canvas from "html2canvas";
44
import jsPDF from "jspdf";
@@ -15,6 +15,7 @@ import {
1515
} from "../data/portfolio-data";
1616
import styles from "./CV.module.css";
1717
import {projects} from "../data/project-list";
18+
import {Particles} from "../components/particles/particles";
1819

1920
interface CVProps {
2021
onClose?: () => void;
@@ -77,7 +78,12 @@ export function CV({ onClose }: CVProps) {
7778

7879
return (
7980
<div className={styles.cvPage}>
80-
<Navbar onNavigateToContact={onClose} />
81+
<Particles />
82+
83+
<Button onClick={onClose} className={styles.backButton} aria-label="Go back">
84+
<ArrowLeft />
85+
<span>Back to Portfolio</span>
86+
</Button>
8187

8288
<Button className={styles.downloadButton} onClick={handleDownloadCV}>
8389
<Download />

v2/src/pages/Home.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default function Home({onNavigateToContact, onNavigateToCV}: HomeProps) {
4040
return (
4141
<div className={styles.page}>
4242
<Particles/>
43-
<Navbar onNavigateToContact={onNavigateToContact} onNavigateToCV={onNavigateToCV}/>
43+
<Navbar onNavigateToContact={onNavigateToContact} onNavigateToCV={onNavigateToCV} currentPage={'home'}/>
4444

4545
{/* Hero Section */}
4646
<section id="hero" className={styles.hero}>

0 commit comments

Comments
 (0)