- Neue About/Skills-Sektion hinzugefügt - Verbesserte UI/UX für alle Komponenten - Enhanced Contact Form mit Validierung - Verbesserte Security Headers und Middleware - Sichere Deployment-Skripte (safe-deploy.sh) - Zero-Downtime Deployment Support - Verbesserte Docker-Sicherheit - Umfassende Sicherheits-Dokumentation - Performance-Optimierungen - Accessibility-Verbesserungen
213 lines
8.0 KiB
TypeScript
213 lines
8.0 KiB
TypeScript
"use client";
|
|
|
|
import { useState, useEffect } from 'react';
|
|
import { motion, AnimatePresence } from 'framer-motion';
|
|
import { Menu, X, Mail } from 'lucide-react';
|
|
import { SiGithub, SiLinkedin } from 'react-icons/si';
|
|
import Link from 'next/link';
|
|
|
|
const Header = () => {
|
|
const [isOpen, setIsOpen] = useState(false);
|
|
const [scrolled, setScrolled] = useState(false);
|
|
const [mounted, setMounted] = useState(false);
|
|
|
|
useEffect(() => {
|
|
setMounted(true);
|
|
}, []);
|
|
|
|
useEffect(() => {
|
|
const handleScroll = () => {
|
|
setScrolled(window.scrollY > 50);
|
|
};
|
|
|
|
window.addEventListener('scroll', handleScroll);
|
|
return () => window.removeEventListener('scroll', handleScroll);
|
|
}, []);
|
|
|
|
const navItems = [
|
|
{ name: 'Home', href: '/' },
|
|
{ name: 'About', href: '#about' },
|
|
{ name: 'Projects', href: '#projects' },
|
|
{ name: 'Contact', href: '#contact' },
|
|
];
|
|
|
|
const socialLinks = [
|
|
{ icon: SiGithub, href: 'https://github.com/Denshooter', label: 'GitHub' },
|
|
{ icon: SiLinkedin, href: 'https://linkedin.com/in/dkonkol', label: 'LinkedIn' },
|
|
{ icon: Mail, href: 'mailto:contact@dk0.dev', label: 'Email' },
|
|
];
|
|
|
|
if (!mounted) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<div className="particles">
|
|
{[...Array(20)].map((_, i) => (
|
|
<div
|
|
key={i}
|
|
className="particle"
|
|
style={{
|
|
left: `${(i * 5.5) % 100}%`,
|
|
animationDelay: `${(i * 0.8) % 20}s`,
|
|
animationDuration: `${20 + (i * 0.4) % 10}s`,
|
|
}}
|
|
/>
|
|
))}
|
|
</div>
|
|
|
|
<motion.header
|
|
initial={{ y: -100 }}
|
|
animate={{ y: 0 }}
|
|
transition={{ duration: 0.8, ease: "easeOut" }}
|
|
className={`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${
|
|
scrolled ? 'glass' : 'bg-transparent'
|
|
}`}
|
|
>
|
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
|
<div className="flex justify-between items-center h-16">
|
|
<motion.div
|
|
whileHover={{ scale: 1.05 }}
|
|
className="flex items-center space-x-2"
|
|
>
|
|
<Link href="/" className="text-2xl font-bold font-mono text-white">
|
|
dk<span className="text-red-500">0</span>
|
|
</Link>
|
|
</motion.div>
|
|
|
|
<nav className="hidden md:flex items-center space-x-8">
|
|
{navItems.map((item) => (
|
|
<motion.div
|
|
key={item.name}
|
|
whileHover={{ y: -2 }}
|
|
whileTap={{ scale: 0.95 }}
|
|
>
|
|
<Link
|
|
href={item.href}
|
|
className="text-gray-300 hover:text-white transition-colors duration-200 font-medium relative group px-2 py-1"
|
|
onClick={(e) => {
|
|
if (item.href.startsWith('#')) {
|
|
e.preventDefault();
|
|
const element = document.querySelector(item.href);
|
|
if (element) {
|
|
element.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
}
|
|
}
|
|
}}
|
|
>
|
|
{item.name}
|
|
<span className="absolute -bottom-1 left-2 right-2 h-0.5 bg-gradient-to-r from-blue-500 to-purple-500 transform scale-x-0 group-hover:scale-x-100 transition-transform duration-300 origin-left"></span>
|
|
</Link>
|
|
</motion.div>
|
|
))}
|
|
</nav>
|
|
|
|
<div className="hidden md:flex items-center space-x-4">
|
|
{socialLinks.map((social) => (
|
|
<motion.a
|
|
key={social.label}
|
|
href={social.href}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
whileHover={{ scale: 1.1, y: -2 }}
|
|
whileTap={{ scale: 0.95 }}
|
|
className="p-2 rounded-lg bg-gray-800/50 hover:bg-gray-700/50 transition-colors duration-200 text-gray-300 hover:text-white"
|
|
>
|
|
<social.icon size={20} />
|
|
</motion.a>
|
|
))}
|
|
</div>
|
|
|
|
<motion.button
|
|
whileTap={{ scale: 0.95 }}
|
|
onClick={() => setIsOpen(!isOpen)}
|
|
className="md:hidden p-2 rounded-lg bg-gray-800/50 hover:bg-gray-700/50 transition-colors duration-200 text-gray-300 hover:text-white"
|
|
>
|
|
{isOpen ? <X size={24} /> : <Menu size={24} />}
|
|
</motion.button>
|
|
</div>
|
|
</div>
|
|
|
|
<AnimatePresence>
|
|
{isOpen && (
|
|
<>
|
|
<motion.div
|
|
initial={{ opacity: 0 }}
|
|
animate={{ opacity: 1 }}
|
|
exit={{ opacity: 0 }}
|
|
transition={{ duration: 0.2 }}
|
|
className="fixed inset-0 bg-black/50 backdrop-blur-sm z-40 md:hidden"
|
|
onClick={() => setIsOpen(false)}
|
|
/>
|
|
<motion.div
|
|
initial={{ opacity: 0, y: -20 }}
|
|
animate={{ opacity: 1, y: 0 }}
|
|
exit={{ opacity: 0, y: -20 }}
|
|
transition={{ duration: 0.3 }}
|
|
className="md:hidden glass border-t border-gray-800/50 z-50 relative"
|
|
>
|
|
<div className="px-4 py-6 space-y-2">
|
|
{navItems.map((item, index) => (
|
|
<motion.div
|
|
key={item.name}
|
|
initial={{ x: -20, opacity: 0 }}
|
|
animate={{ x: 0, opacity: 1 }}
|
|
exit={{ x: -20, opacity: 0 }}
|
|
transition={{ delay: index * 0.05 }}
|
|
>
|
|
<Link
|
|
href={item.href}
|
|
onClick={(e) => {
|
|
setIsOpen(false);
|
|
if (item.href.startsWith('#')) {
|
|
e.preventDefault();
|
|
setTimeout(() => {
|
|
const element = document.querySelector(item.href);
|
|
if (element) {
|
|
element.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
}
|
|
}, 100);
|
|
}
|
|
}}
|
|
className="block text-gray-300 hover:text-white transition-all duration-200 font-medium py-3 px-4 rounded-lg hover:bg-gray-800/50 border-l-2 border-transparent hover:border-blue-500"
|
|
>
|
|
{item.name}
|
|
</Link>
|
|
</motion.div>
|
|
))}
|
|
|
|
<div className="pt-4 mt-4 border-t border-gray-700/50">
|
|
<p className="text-xs text-gray-500 mb-3 px-4">Connect with me</p>
|
|
<div className="flex space-x-3 px-4">
|
|
{socialLinks.map((social, index) => (
|
|
<motion.a
|
|
key={social.label}
|
|
href={social.href}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
initial={{ scale: 0, opacity: 0 }}
|
|
animate={{ scale: 1, opacity: 1 }}
|
|
transition={{ delay: (navItems.length + index) * 0.05 }}
|
|
whileHover={{ scale: 1.1, y: -2 }}
|
|
whileTap={{ scale: 0.95 }}
|
|
className="p-3 rounded-xl bg-gray-800/50 hover:bg-gray-700/50 transition-all duration-200 text-gray-300 hover:text-white"
|
|
aria-label={social.label}
|
|
>
|
|
<social.icon size={20} />
|
|
</motion.a>
|
|
))}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</motion.div>
|
|
</>
|
|
)}
|
|
</AnimatePresence>
|
|
</motion.header>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default Header;
|