2026-04-30 22:36:40 +06:00
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
|
import { useProjects } from "@/hooks/queires/useProjects";
|
|
|
|
|
import { motion, useInView } from "framer-motion";
|
|
|
|
|
import { ArrowRight, ExternalLink } from "lucide-react";
|
|
|
|
|
import { useRef, useState } from "react";
|
|
|
|
|
import { Link } from "react-router-dom";
|
2026-04-05 01:20:52 +06:00
|
|
|
|
|
|
|
|
const gradientColors = [
|
2026-04-30 22:36:40 +06:00
|
|
|
"from-neon-blue/90",
|
|
|
|
|
"from-neon-purple/90",
|
|
|
|
|
"from-neon-green/90",
|
|
|
|
|
"from-neon-pink/90",
|
2026-03-30 20:20:21 +06:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export default function ProjectsSection() {
|
2026-04-05 01:20:52 +06:00
|
|
|
const { data: projectsData } = useProjects({
|
2026-04-30 22:36:40 +06:00
|
|
|
fields: "category, title, image, liveUrl",
|
|
|
|
|
limit: 6,
|
2026-04-05 01:20:52 +06:00
|
|
|
});
|
|
|
|
|
|
2026-04-30 22:36:40 +06:00
|
|
|
const projects = projectsData?.data.data.result || [];
|
2026-04-05 01:20:52 +06:00
|
|
|
|
2026-03-30 20:20:21 +06:00
|
|
|
const ref = useRef<HTMLElement>(null);
|
2026-04-30 22:36:40 +06:00
|
|
|
const isInView = useInView(ref, { once: true, margin: "-100px" });
|
2026-03-30 20:20:21 +06:00
|
|
|
|
|
|
|
|
return (
|
2026-04-30 22:36:40 +06:00
|
|
|
<section
|
|
|
|
|
id="projects"
|
|
|
|
|
ref={ref}
|
|
|
|
|
className="py-24 relative overflow-hidden bg-secondary/30"
|
|
|
|
|
>
|
|
|
|
|
{/* Background Pattern */}
|
2026-03-30 20:20:21 +06:00
|
|
|
<div className="absolute inset-0 opacity-5">
|
2026-04-30 22:36:40 +06:00
|
|
|
<div
|
|
|
|
|
className="absolute inset-0"
|
|
|
|
|
style={{
|
|
|
|
|
backgroundImage: `radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)`,
|
|
|
|
|
backgroundSize: "40px 40px",
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2026-03-30 20:20:21 +06:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="container mx-auto px-4 relative z-10">
|
|
|
|
|
{/* Section Header */}
|
|
|
|
|
<motion.div
|
|
|
|
|
initial={{ opacity: 0, y: 20 }}
|
|
|
|
|
animate={isInView ? { opacity: 1, y: 0 } : {}}
|
2026-04-30 22:36:40 +06:00
|
|
|
transition={{ duration: 0.7 }}
|
|
|
|
|
className="text-center mb-20"
|
2026-03-30 20:20:21 +06:00
|
|
|
>
|
2026-04-30 22:36:40 +06:00
|
|
|
<span className="inline-block px-5 py-2 rounded-full glass text-sm font-medium text-primary mb-4 tracking-widest">
|
|
|
|
|
OUR PORTFOLIO
|
2026-03-30 20:20:21 +06:00
|
|
|
</span>
|
2026-04-30 22:36:40 +06:00
|
|
|
<h2 className="text-4xl md:text-5xl lg:text-6xl font-bold mb-6">
|
|
|
|
|
Featured{" "}
|
|
|
|
|
<span className="text-primary neon-text-glow">Projects</span>
|
2026-03-30 20:20:21 +06:00
|
|
|
</h2>
|
|
|
|
|
<p className="text-muted-foreground max-w-2xl mx-auto text-lg">
|
2026-04-30 22:36:40 +06:00
|
|
|
Crafted with passion. Delivered with excellence.
|
2026-03-30 20:20:21 +06:00
|
|
|
</p>
|
|
|
|
|
</motion.div>
|
|
|
|
|
|
|
|
|
|
{/* Projects Grid */}
|
2026-04-30 22:36:40 +06:00
|
|
|
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-8 mb-16">
|
|
|
|
|
{projects.map((project, index) => {
|
2026-04-05 01:20:52 +06:00
|
|
|
const color = gradientColors[index % gradientColors.length];
|
|
|
|
|
|
|
|
|
|
return (
|
2026-04-30 22:36:40 +06:00
|
|
|
<ProjectCard
|
2026-04-05 01:20:52 +06:00
|
|
|
key={project._id}
|
2026-04-30 22:36:40 +06:00
|
|
|
project={project}
|
|
|
|
|
color={color}
|
|
|
|
|
index={index}
|
|
|
|
|
isInView={isInView}
|
|
|
|
|
/>
|
2026-04-05 01:20:52 +06:00
|
|
|
);
|
|
|
|
|
})}
|
2026-03-30 20:20:21 +06:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* See All Button */}
|
|
|
|
|
<motion.div
|
2026-04-30 22:36:40 +06:00
|
|
|
initial={{ opacity: 0, y: 30 }}
|
2026-03-30 20:20:21 +06:00
|
|
|
animate={isInView ? { opacity: 1, y: 0 } : {}}
|
2026-04-30 22:36:40 +06:00
|
|
|
transition={{ duration: 0.7, delay: 0.3 }}
|
|
|
|
|
className="flex justify-center"
|
2026-03-30 20:20:21 +06:00
|
|
|
>
|
|
|
|
|
<Link to="/projects">
|
|
|
|
|
<Button
|
|
|
|
|
size="lg"
|
2026-04-30 22:36:40 +06:00
|
|
|
className="bg-primary hover:bg-primary/90 text-primary-foreground font-semibold px-10 py-7 text-lg rounded-full neon-glow hover:neon-glow-strong transition-all group flex items-center gap-3"
|
2026-03-30 20:20:21 +06:00
|
|
|
>
|
2026-04-30 22:36:40 +06:00
|
|
|
Explore All Projects
|
|
|
|
|
<ArrowRight className="w-6 h-6 group-hover:translate-x-1 transition-transform" />
|
2026-03-30 20:20:21 +06:00
|
|
|
</Button>
|
|
|
|
|
</Link>
|
|
|
|
|
</motion.div>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
);
|
|
|
|
|
}
|
2026-04-30 22:36:40 +06:00
|
|
|
|
|
|
|
|
function ProjectCard({ project, color, index, isInView }) {
|
|
|
|
|
const [mousePosition, setMousePosition] = useState({ x: 50, y: 50 });
|
|
|
|
|
const [isHovered, setIsHovered] = useState(false);
|
|
|
|
|
|
|
|
|
|
const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => {
|
|
|
|
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
|
|
|
const x = ((e.clientX - rect.left) / rect.width) * 100;
|
|
|
|
|
const y = ((e.clientY - rect.top) / rect.height) * 100;
|
|
|
|
|
setMousePosition({ x, y });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<motion.div
|
|
|
|
|
initial={{ opacity: 0, y: 60, rotateX: 15 }}
|
|
|
|
|
animate={isInView ? { opacity: 1, y: 0, rotateX: 0 } : {}}
|
|
|
|
|
transition={{ duration: 0.6, delay: index * 0.08 }}
|
|
|
|
|
whileHover={{ scale: 1.02 }}
|
|
|
|
|
className="group relative rounded-3xl overflow-hidden cursor-pointer h-full"
|
|
|
|
|
onMouseMove={handleMouseMove}
|
|
|
|
|
onMouseEnter={() => setIsHovered(true)}
|
|
|
|
|
onMouseLeave={() => {
|
|
|
|
|
setIsHovered(false);
|
|
|
|
|
setMousePosition({ x: 50, y: 50 });
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{/* Main Card Container with 3D Tilt */}
|
|
|
|
|
<div
|
|
|
|
|
className="relative h-full rounded-3xl overflow-hidden shadow-2xl transition-transform duration-300"
|
|
|
|
|
style={{
|
|
|
|
|
transform: isHovered
|
|
|
|
|
? `perspective(1000px) rotateX(${(50 - mousePosition.y) * 0.12}deg) rotateY(${(mousePosition.x - 50) * 0.15}deg)`
|
|
|
|
|
: "perspective(1000px) rotateX(0deg) rotateY(0deg)",
|
|
|
|
|
transition: isHovered
|
|
|
|
|
? "transform 0.1s ease-out"
|
|
|
|
|
: "transform 0.4s ease-out",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{/* Image Container */}
|
|
|
|
|
<div className="aspect-[16/13] overflow-hidden relative">
|
|
|
|
|
<img
|
|
|
|
|
src={project.image}
|
|
|
|
|
alt={project.title}
|
|
|
|
|
className="w-full h-full object-cover transition-transform duration-700 group-hover:scale-110"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
{/* Dynamic Shine Overlay */}
|
|
|
|
|
<div
|
|
|
|
|
className="absolute inset-0 opacity-0 group-hover:opacity-30 transition-opacity duration-300 pointer-events-none"
|
|
|
|
|
style={{
|
|
|
|
|
background: `radial-gradient(circle at ${mousePosition.x}% ${mousePosition.y}%, rgba(255,255,255,0.8) 0%, transparent 60%)`,
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Gradient Overlay */}
|
|
|
|
|
<div
|
|
|
|
|
className={`absolute inset-0 bg-gradient-to-t ${color} via-black/40 to-transparent opacity-60 group-hover:opacity-90 transition-all duration-500`}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
{/* Content */}
|
|
|
|
|
<div className="absolute inset-0 flex flex-col justify-end p-8">
|
|
|
|
|
<div className="space-y-4 transform transition-all duration-500 group-hover:translate-y-0">
|
|
|
|
|
{/* Category */}
|
|
|
|
|
<motion.span
|
|
|
|
|
initial={{ opacity: 0, y: 20 }}
|
|
|
|
|
animate={
|
|
|
|
|
isHovered ? { opacity: 1, y: 0 } : { opacity: 0.7, y: 10 }
|
|
|
|
|
}
|
|
|
|
|
className="inline-block px-4 py-1.5 rounded-full bg-white/10 backdrop-blur-md text-white text-xs font-medium border border-white/20"
|
|
|
|
|
>
|
|
|
|
|
{project.category}
|
|
|
|
|
</motion.span>
|
|
|
|
|
|
|
|
|
|
{/* Title */}
|
|
|
|
|
<h3 className="text-2xl md:text-3xl font-bold text-white leading-tight tracking-tight">
|
|
|
|
|
{project.title}
|
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
|
|
{/* View Project Link */}
|
|
|
|
|
<Link
|
|
|
|
|
to={project.liveUrl}
|
|
|
|
|
className="flex items-center gap-3 text-white/80 group-hover:text-white transition-colors"
|
|
|
|
|
>
|
|
|
|
|
<span className="font-medium text-sm tracking-wider">live</span>
|
|
|
|
|
<ExternalLink className="w-5 h-5 transition-transform group-hover:rotate-45" />
|
|
|
|
|
</Link>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Neon Border Glow */}
|
|
|
|
|
<div className="absolute inset-0 rounded-3xl border-2 border-transparent group-hover:border-primary/60 transition-all duration-500 pointer-events-none neon-glow" />
|
|
|
|
|
</div>
|
|
|
|
|
</motion.div>
|
|
|
|
|
);
|
|
|
|
|
}
|