diff --git a/src/app/page.jsx b/src/app/page.jsx index 39b204c2..c9375748 100644 --- a/src/app/page.jsx +++ b/src/app/page.jsx @@ -24,6 +24,7 @@ import projects from '@/helper/projects' export default function Home() { const [randomProjects, setRandomProjects] = useState([]) const [featuredProjects, setFeaturedProjects] = useState([]) + const[hoveredProjectIndex, setHoveredProjectIndex] = useState(null) useEffect(() => { // Select specific projects as featured @@ -210,15 +211,31 @@ export default function Home() {
- {randomProjects.map((project) => ( -
+ {randomProjects.map((project, index) =>{ + + const isHovered = hoveredProjectIndex === index; + const isDimmed = hoveredProjectIndex != null && !isHovered; + const offSetDirection = indexsetHoveredProjectIndex(index)} + onMouseLeave={()=>setHoveredProjectIndex(null)} + onFocus={()=>setHoveredProjectIndex(index)} + onBlur={()=>setHoveredProjectIndex(null)} + >
- ))} + ) + })}
diff --git a/src/components/home/CardEffect.jsx b/src/components/home/CardEffect.jsx index 6eabbe57..fd80b47e 100644 --- a/src/components/home/CardEffect.jsx +++ b/src/components/home/CardEffect.jsx @@ -2,23 +2,45 @@ import Image from 'next/image' import { motion } from 'framer-motion' +import Link from 'next/link' -export function CardEffect({ heading, content, logo }) { +const MotionLink = motion(Link) + +export function CardEffect({ heading, content, logo, href = '#', isHovered = false, isDimmed = false, offSetDirection = 0 }) { + + const isExternalLink = href.startsWith("http") + const shouldShift = isDimmed && offSetDirection !== 0 + const shiftAmount = offSetDirection * 18 const wrappedHeading = (heading ?? '') .replace(/([a-z])([A-Z])/g, '$1\u200B$2') .replace(/([A-Z])([A-Z][a-z])/g, '$1\u200B$2') return ( - -
- +
{/* Front Face */}
@@ -49,6 +71,6 @@ export function CardEffect({ heading, content, logo }) {
- + ) } \ No newline at end of file