@@ -3,6 +3,8 @@ import { Link, useLocation } from 'react-router-dom';
33import { motion } from 'motion/react' ;
44import { Menu , X } from 'lucide-react' ;
55import contentData from '../data/content' ;
6+ import { brandColors , brandColorsArray } from '../styles/brandColors' ;
7+ import { getPageActiveHintColor , getPageNameFromPath } from '../utils/brandColorsConfig' ;
68
79export function Navigation ( ) {
810 const [ isScrolled , setIsScrolled ] = useState ( false ) ;
@@ -20,13 +22,40 @@ export function Navigation() {
2022
2123 const navLinks = contentData . navigation . links ;
2224
25+ // Get brand color for each tab - use CMS config for active hints per page
26+ const getTabColor = ( link : { path : string ; label : string } , index : number ) : string => {
27+ const isActive = location . pathname === link . path ;
28+
29+ if ( isActive ) {
30+ // Get the active hint color for this specific page from CMS
31+ const pageName = getPageNameFromPath ( link . path ) ;
32+ if ( pageName ) {
33+ return getPageActiveHintColor ( pageName ) ;
34+ }
35+ // Fallback: Photography always uses blue
36+ if ( link . path === '/photography' || link . label === 'Photography' ) {
37+ return brandColors . blue ;
38+ }
39+ // Default fallback
40+ return brandColorsArray [ index % brandColorsArray . length ] ;
41+ }
42+
43+ // For inactive tabs, cycle through colors
44+ // Photography always uses blue
45+ if ( link . path === '/photography' || link . label === 'Photography' ) {
46+ return brandColors . blue ;
47+ }
48+ return brandColorsArray [ index % brandColorsArray . length ] ;
49+ } ;
50+
2351 return (
2452 < motion . nav
2553 initial = { { y : - 100 } }
2654 animate = { { y : 0 } }
2755 className = { `fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${
28- isScrolled ? 'glassmorphism border-b border-black/5 ' : 'bg-transparent'
56+ isScrolled ? 'glassmorphism border-b' : 'bg-transparent'
2957 } `}
58+ style = { isScrolled ? { borderBottomColor : `${ brandColors . blue } 20` } : { } }
3059 >
3160 < div className = "max-w-7xl mx-auto px-6 lg:px-12" >
3261 < div className = "flex items-center justify-between h-16 lg:h-20" >
@@ -44,31 +73,53 @@ export function Navigation() {
4473
4574 { /* Desktop Navigation */ }
4675 < div className = "hidden lg:flex items-center gap-1" >
47- { navLinks . map ( ( link : { path : string ; label : string } ) => (
48- < Link
49- key = { link . path }
50- to = { link . path }
51- className = "relative px-4 py-2 transition-colors group"
52- >
53- < span className = "relative z-10 text-sm" >
54- { link . label }
55- </ span >
56- { location . pathname === link . path && (
57- < motion . div
58- layoutId = "activeTab"
59- className = "absolute inset-0 bg-black/5 rounded-lg"
60- transition = { { type : 'spring' , bounce : 0.2 , duration : 0.6 } }
76+ { navLinks . map ( ( link : { path : string ; label : string } , index : number ) => {
77+ const isActive = location . pathname === link . path ;
78+ const tabColor = getTabColor ( link , index ) ;
79+
80+ return (
81+ < Link
82+ key = { link . path }
83+ to = { link . path }
84+ className = "relative px-4 py-2 transition-colors group"
85+ >
86+ < span className = "relative z-10 text-sm" >
87+ { link . label }
88+ </ span >
89+ { isActive && (
90+ < motion . div
91+ layoutId = "activeTab"
92+ className = "absolute inset-0 rounded-lg backdrop-blur-sm"
93+ style = { {
94+ backgroundColor : `${ tabColor } 20` ,
95+ borderBottom : `1px solid ${ tabColor } 40` ,
96+ boxShadow : `0 1px 2px ${ tabColor } 20` ,
97+ } }
98+ transition = { { type : 'spring' , bounce : 0.2 , duration : 0.6 } }
99+ />
100+ ) }
101+ < div
102+ className = "absolute inset-0 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity"
103+ style = { { backgroundColor : `${ brandColors . white } 30` } }
61104 />
62- ) }
63- < div className = "absolute inset-0 bg-black/[0.02] rounded-lg opacity-0 group-hover:opacity-100 transition-opacity" />
64- </ Link >
65- ) ) }
105+ </ Link >
106+ ) ;
107+ } ) }
66108 </ div >
67109
68110 { /* Mobile Menu Button */ }
69111 < button
70112 onClick = { ( ) => setIsMobileMenuOpen ( ! isMobileMenuOpen ) }
71- className = "lg:hidden p-2 rounded-lg hover:bg-black/5 transition-colors"
113+ className = "lg:hidden p-2 rounded-lg transition-colors"
114+ style = { {
115+ backgroundColor : 'transparent' ,
116+ } }
117+ onMouseEnter = { ( e ) => {
118+ e . currentTarget . style . backgroundColor = `${ brandColors . white } 20` ;
119+ } }
120+ onMouseLeave = { ( e ) => {
121+ e . currentTarget . style . backgroundColor = 'transparent' ;
122+ } }
72123 aria-label = "Toggle menu"
73124 >
74125 { isMobileMenuOpen ? < X size = { 24 } /> : < Menu size = { 24 } /> }
@@ -82,23 +133,40 @@ export function Navigation() {
82133 initial = { { opacity : 0 , y : - 20 } }
83134 animate = { { opacity : 1 , y : 0 } }
84135 exit = { { opacity : 0 , y : - 20 } }
85- className = "lg:hidden glassmorphism border-t border-black/5"
136+ className = "lg:hidden glassmorphism border-t"
137+ style = { { borderTopColor : `${ brandColors . blue } 20` } }
86138 >
87139 < div className = "max-w-7xl mx-auto px-6 py-4 space-y-1" >
88- { navLinks . map ( ( link : { path : string ; label : string } ) => (
89- < Link
90- key = { link . path }
91- to = { link . path }
92- onClick = { ( ) => setIsMobileMenuOpen ( false ) }
93- className = { `block px-4 py-3 rounded-lg transition-colors ${
94- location . pathname === link . path
95- ? 'bg-black/5'
96- : 'hover:bg-black/[0.02]'
97- } `}
98- >
99- { link . label }
100- </ Link >
101- ) ) }
140+ { navLinks . map ( ( link : { path : string ; label : string } , index : number ) => {
141+ const isActive = location . pathname === link . path ;
142+ const tabColor = getTabColor ( link , index ) ;
143+
144+ return (
145+ < Link
146+ key = { link . path }
147+ to = { link . path }
148+ onClick = { ( ) => setIsMobileMenuOpen ( false ) }
149+ className = "block px-4 py-3 rounded-lg transition-all backdrop-blur-sm"
150+ style = { {
151+ backgroundColor : isActive ? `${ tabColor } 20` : 'transparent' ,
152+ borderLeft : isActive ? `2px solid ${ tabColor } 60` : '2px solid transparent' ,
153+ boxShadow : isActive ? `inset 0 0 10px ${ tabColor } 10` : 'none' ,
154+ } }
155+ onMouseEnter = { ( e ) => {
156+ if ( ! isActive ) {
157+ e . currentTarget . style . backgroundColor = `${ brandColors . white } 20` ;
158+ }
159+ } }
160+ onMouseLeave = { ( e ) => {
161+ if ( ! isActive ) {
162+ e . currentTarget . style . backgroundColor = 'transparent' ;
163+ }
164+ } }
165+ >
166+ { link . label }
167+ </ Link >
168+ ) ;
169+ } ) }
102170 </ div >
103171 </ motion . div >
104172 ) }
0 commit comments