feat: add Contact link to header nav that opens ContactModal
This commit is contained in:
parent
3040032479
commit
1c7995704d
1 changed files with 23 additions and 5 deletions
|
|
@ -5,10 +5,12 @@ import Link from 'next/link'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { usePathname } from 'next/navigation'
|
import { usePathname } from 'next/navigation'
|
||||||
import { Menu, X } from 'lucide-react'
|
import { Menu, X } from 'lucide-react'
|
||||||
|
import ContactModal from '../shared/ContactModal'
|
||||||
|
|
||||||
export default function Header() {
|
export default function Header() {
|
||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
const [isOpen, setIsOpen] = useState(false)
|
const [isOpen, setIsOpen] = useState(false)
|
||||||
|
const [isContactModalOpen, setIsContactModalOpen] = useState(false)
|
||||||
|
|
||||||
const isActive = (path: string) => {
|
const isActive = (path: string) => {
|
||||||
return pathname === path
|
return pathname === path
|
||||||
|
|
@ -75,6 +77,12 @@ export default function Header() {
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
|
<li>
|
||||||
|
<button onClick={() => setIsContactModalOpen(true)} className="relative group">
|
||||||
|
<span className="transition-colors hover:text-blue-600">Contact</span>
|
||||||
|
<motion.div className="absolute -bottom-1 left-0 w-0 h-0.5 bg-gradient-to-r from-blue-600 to-mcdi-maroon transition-all duration-300 group-hover:w-full" />
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
|
@ -113,9 +121,19 @@ export default function Header() {
|
||||||
</Link>
|
</Link>
|
||||||
</motion.li>
|
</motion.li>
|
||||||
))}
|
))}
|
||||||
|
<motion.li whileHover={{ x: 10 }} whileTap={{ scale: 0.95 }}>
|
||||||
|
<button
|
||||||
|
className="block w-full text-left p-2 rounded-lg hover:bg-gray-50"
|
||||||
|
onClick={() => { setIsOpen(false); setIsContactModalOpen(true) }}
|
||||||
|
>
|
||||||
|
Contact
|
||||||
|
</button>
|
||||||
|
</motion.li>
|
||||||
</ul>
|
</ul>
|
||||||
</motion.nav>
|
</motion.nav>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<ContactModal isOpen={isContactModalOpen} onClose={() => setIsContactModalOpen(false)} />
|
||||||
</motion.header>
|
</motion.header>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue