Spaces:
Sleeping

anycoder-69112ea1 / components /HeroSection.jsx
Maj3stiCD's picture
Upload components/HeroSection.jsx with huggingface_hub
96cd2f9 verified
Raw History Blame Contribute Delete
5.78 kB
import { useEffect, useRef } from 'react'
import { ArrowDown, Terminal, Zap, Globe, ChevronRight } from 'lucide-react'
export default function HeroSection() {
const canvasRef = useRef(null)
useEffect(() => {
const canvas = canvasRef.current
if (!canvas) return
const ctx = canvas.getContext('2d')
let animationId
const resize = () => {
canvas.width = window.innerWidth
canvas.height = window.innerHeight
}
resize()
window.addEventListener('resize', resize)
const particles = []
const particleCount = 80
const connectionDistance = 120
for (let i = 0; i < particleCount; i++) {
particles.push({
x: Math.random() * canvas.width,
y: Math.random() * canvas.height,
vx: (Math.random() - 0.5) * 0.5,
vy: (Math.random() - 0.5) * 0.5,
radius: Math.random() * 2 + 1,
})
}
const animate = () => {
ctx.clearRect(0, 0, canvas.width, canvas.height)
for (let i = 0; i < particles.length; i++) {
const p = particles[i]
p.x += p.vx
p.y += p.vy
if (p.x < 0 || p.x > canvas.width) p.vx *= -1
if (p.y < 0 || p.y > canvas.height) p.vy *= -1
ctx.beginPath()
ctx.arc(p.x, p.y, p.radius, 0, Math.PI * 2)
ctx.fillStyle = 'rgba(56, 189, 248, 0.6)'
ctx.fill()
}
for (let i = 0; i < particles.length; i++) {
for (let j = i + 1; j < particles.length; j++) {
const dx = particles[i].x - particles[j].x
const dy = particles[i].y - particles[j].y
const dist = Math.sqrt(dx * dx + dy * dy)
if (dist < connectionDistance) {
ctx.beginPath()
ctx.moveTo(particles[i].x, particles[i].y)
ctx.lineTo(particles[j].x, particles[j].y)
ctx.strokeStyle = `rgba(56, 189, 248, ${0.15 * (1 - dist / connectionDistance)})`
ctx.lineWidth = 0.5
ctx.stroke()
}
}
}
animationId = requestAnimationFrame(animate)
}
animate()
return () => {
cancelAnimationFrame(animationId)
window.removeEventListener('resize', resize)
}
}, [])
return (
<section className="relative min-h-screen flex items-center justify-center overflow-hidden">
<canvas ref={canvasRef} className="absolute inset-0 z-0" />
<div className="absolute inset-0 bg-gradient-to-b from-transparent via-slate-950/50 to-slate-950 z-[1]" />
<div className="relative z-10 max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 text-center">
<div className="inline-flex items-center gap-2 px-4 py-2 rounded-full bg-slate-800/60 border border-slate-700/50 mb-8 animate-slide-up">
<span className="w-2 h-2 rounded-full bg-emerald-400 animate-pulse-fast" />
<span className="text-sm text-slate-300 font-mono">
v2.4.1-stable
</span>
<span className="w-px h-3 bg-slate-600 mx-1" />
<span className="text-sm text-slate-400">Open Source</span>
</div>
<h1 className="text-5xl sm:text-6xl lg:text-8xl font-black tracking-tighter mb-6 animate-slide-up" style={{ animationDelay: '0.1s' }}>
<span className="text-white">daKI</span>
<span className="text-gradient">tech</span>
<span className="text-slate-500">.dev</span>
</h1>
<p className="text-lg sm:text-xl text-slate-400 max-w-2xl mx-auto mb-4 leading-relaxed animate-slide-up font-light" style={{ animationDelay: '0.2s' }}>
Next-gen developer tools, AI-powered frameworks, and open source
utilities. Built for the developers who push boundaries.
</p>
<div className="flex flex-wrap items-center justify-center gap-4 mb-12 animate-slide-up" style={{ animationDelay: '0.3s' }}>
<span className="flex items-center gap-1.5 text-sm text-slate-500 font-mono">
<Terminal className="w-3.5 h-3.5" />
TypeScript
</span>
<span className="text-slate-700">|</span>
<span className="flex items-center gap-1.5 text-sm text-slate-500 font-mono">
<Zap className="w-3.5 h-3.5" />
Rust
</span>
<span className="text-slate-700">|</span>
<span className="flex items-center gap-1.5 text-sm text-slate-500 font-mono">
<Globe className="w-3.5 h-3.5" />
Python
</span>
</div>
<div className="flex flex-col sm:flex-row items-center justify-center gap-4 animate-slide-up" style={{ animationDelay: '0.4s' }}>
<a
href="#projects"
className="group flex items-center gap-2 px-8 py-3.5 bg-gradient-to-r from-primary-600 to-sky-500 hover:from-primary-500 hover:to-sky-400 text-white font-semibold rounded-xl transition-all shadow-lg shadow-primary-500/20 hover:shadow-primary-500/30"
>
Explore Projects
<ChevronRight className="w-4 h-4 group-hover:translate-x-0.5 transition-transform" />
</a>
<a
href="#terminal"
className="flex items-center gap-2 px-8 py-3.5 glass text-slate-200 font-medium rounded-xl hover:bg-slate-800/80 transition-all"
>
<Terminal className="w-4 h-4" />
Try Terminal
</a>
</div>
<div className="mt-20 animate-fade-in" style={{ animationDelay: '0.8s' }}>
<a href="#projects" className="inline-flex flex-col items-center gap-2 text-slate-500 hover:text-slate-300 transition-colors group">
<span className="text-xs font-mono tracking-widest uppercase">Scroll</span>
<ArrowDown className="w-4 h-4 animate-bounce" />
</a>
</div>
</div>
</section>
)
}