Skip to content

Commit 4a09595

Browse files
committed
responsive
1 parent 8bf98bd commit 4a09595

1 file changed

Lines changed: 29 additions & 3 deletions

File tree

src/components/Navigation.tsx

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useState, useEffect, useRef } from 'react';
22
import { Link, useLocation } from 'react-router-dom';
33
import { motion } from 'motion/react';
4-
import { Menu, X } from 'lucide-react';
4+
import { Menu, X, Hand, BookOpen, FolderKanban, Camera, Home } from 'lucide-react';
55
import contentData from '../data/content';
66

77
interface NavigationProps {
@@ -68,6 +68,16 @@ export function Navigation({ inline = false }: NavigationProps) {
6868

6969
const navLinks = inline ? (contentData.navigation.homeLinks || contentData.navigation.links) : contentData.navigation.links;
7070

71+
// Icon mapping for navigation links
72+
const getIconForPath = (path: string) => {
73+
if (path === '/') return Home;
74+
if (path === '/about') return Hand;
75+
if (path === '/storiesofadventure') return BookOpen;
76+
if (path === '/projects') return FolderKanban;
77+
if (path === '/photography') return Camera;
78+
return null;
79+
};
80+
7181
// Exact same header menu behaviour, rendered inline below content (e.g. below Namaste on Home)
7282
if (inline) {
7383
return (
@@ -141,12 +151,13 @@ export function Navigation({ inline = false }: NavigationProps) {
141151
>
142152
{navLinks.map((link: { path: string; label: string }, index: number) => {
143153
const isActive = location.pathname === link.path;
154+
const IconComponent = getIconForPath(link.path);
144155
return (
145156
<Link
146157
key={link.path}
147158
ref={(el) => { tabRefs.current[index] = el; }}
148159
to={link.path}
149-
className="relative px-3 xl:px-6 py-3 transition-colors group rounded-lg flex-shrink-0 text-center whitespace-nowrap"
160+
className="relative px-3 xl:px-6 py-3 transition-colors group rounded-lg flex-shrink-0 text-center whitespace-nowrap flex items-center justify-center gap-1.5"
150161
>
151162
{isActive && (
152163
<motion.div
@@ -155,6 +166,13 @@ export function Navigation({ inline = false }: NavigationProps) {
155166
transition={{ type: 'spring', bounce: 0.2, duration: 0.5 }}
156167
/>
157168
)}
169+
{IconComponent && (
170+
<IconComponent className={`relative z-10 w-4 h-4 transition-all ${
171+
isActive
172+
? 'text-gray-900 opacity-100'
173+
: 'text-gray-600 opacity-50 group-hover:text-gray-900 group-hover:opacity-100'
174+
}`} />
175+
)}
158176
<span
159177
className={`relative z-10 font-medium transition-all ${
160178
isActive
@@ -197,17 +215,25 @@ export function Navigation({ inline = false }: NavigationProps) {
197215
<div className="w-full max-w-[90rem] mx-auto px-4 sm:px-6 py-4 sm:py-5 space-y-2 text-center">
198216
{navLinks.map((link: { path: string; label: string }) => {
199217
const isActive = location.pathname === link.path;
218+
const IconComponent = getIconForPath(link.path);
200219
return (
201220
<Link
202221
key={link.path}
203222
to={link.path}
204223
onClick={() => setIsMobileMenuOpen(false)}
205-
className={`block w-full py-4 px-6 rounded-xl transition-colors touch-manipulation min-h-[48px] flex items-center justify-center ${
224+
className={`block w-full py-4 px-6 rounded-xl transition-colors touch-manipulation min-h-[48px] flex items-center justify-center gap-2 ${
206225
isActive
207226
? 'bg-gray-100/90 border border-gray-200/60 font-semibold text-gray-900 text-xl sm:text-2xl'
208227
: 'font-medium text-gray-600 opacity-50 active:opacity-100 active:bg-black/5 hover:opacity-100 hover:bg-black/[0.02] hover:text-gray-900 text-base sm:text-lg'
209228
}`}
210229
>
230+
{IconComponent && (
231+
<IconComponent className={`w-5 h-5 sm:w-6 sm:h-6 ${
232+
isActive
233+
? 'text-gray-900'
234+
: 'text-gray-600 opacity-50'
235+
}`} />
236+
)}
211237
{link.label}
212238
</Link>
213239
);

0 commit comments

Comments
 (0)