-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
132 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
"use client"; | ||
|
||
import { TProject } from "@/app/types"; | ||
import { cn } from "@/lib/utils"; | ||
import { motion } from "framer-motion"; | ||
import { ArrowUpRight, Github } from "lucide-react"; | ||
import Image from "next/image"; | ||
import Link from "next/link"; | ||
import React from "react"; | ||
|
||
export default function ImageCard({ | ||
isOdd, | ||
project, | ||
}: { | ||
isOdd: boolean; | ||
project: TProject; | ||
}) { | ||
const [activeCard, setActiveCard] = React.useState(false); | ||
|
||
const handleMouseEnter = () => { | ||
setActiveCard(true); | ||
}; | ||
|
||
const handleMouseLeave = () => { | ||
setActiveCard(false); | ||
}; | ||
|
||
return ( | ||
<> | ||
{project.linkToGH ? ( | ||
<motion.div | ||
onMouseEnter={handleMouseEnter} | ||
onMouseLeave={handleMouseLeave} | ||
className={cn( | ||
"relative lg:flex hidden bg-gray-50 w-[50%] h-full rounded-xl z-10 group overflow-hidden border shadow-md dark:bg-black dark:border-gray-800", | ||
isOdd && "order-2" | ||
)} | ||
> | ||
<motion.div | ||
initial={{ width: "100%", height: "100%" }} | ||
animate={{ | ||
width: activeCard ? "60%" : "100%", | ||
height: activeCard ? "100%" : "100%", | ||
}} | ||
transition={{ duration: 0.3, ease: "easeInOut" }} | ||
className="relative z-10" | ||
> | ||
<Image | ||
fill | ||
sizes="100%" | ||
priority={false} | ||
src={project.image} | ||
alt={project.title} | ||
className="object-cover object-center" | ||
/> | ||
</motion.div> | ||
<div className="absolute inset-0 flex justify-end w-full h-full border"> | ||
<div className="mr-6 flex flex-col justify-center items-center gap-4"> | ||
<Link | ||
target="_blank" | ||
href={project.linkToGH ?? "/"} | ||
className="flex items-start gap-2 text-sm hover:underline underline-offset-2 w-full" | ||
> | ||
<Github size={20} /> | ||
View on Github | ||
</Link> | ||
<Link | ||
target="_blank" | ||
href={project.link ?? "/"} | ||
className="flex items-start gap-2 text-sm hover:underline underline-offset-2 w-full" | ||
> | ||
<ArrowUpRight size={20} /> | ||
Live Url Here | ||
</Link> | ||
</div> | ||
</div> | ||
</motion.div> | ||
) : ( | ||
<Link | ||
href={project.link} | ||
target="_blank" | ||
className={cn( | ||
"relative hidden lg:block bg-gray-50 w-[50%] h-full rounded-xl z-10 group overflow-clip", | ||
isOdd && "order-2" | ||
)} | ||
> | ||
<Image | ||
fill | ||
sizes="100%" | ||
priority={false} | ||
src={project.image} | ||
alt={project.title} | ||
className="grayscale group-hover:grayscale-0 group-hover:scale-110 transition-all duration-500 object-cover object-center" | ||
/> | ||
</Link> | ||
)} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
export type TJob = { | ||
title: string; | ||
text: string; | ||
time: string; | ||
}; | ||
|
||
export type TProject = { | ||
title: string; | ||
description: string; | ||
image: string; | ||
link: string; | ||
}; | ||
export type TJob = { | ||
title: string; | ||
text: string; | ||
time: string; | ||
}; | ||
|
||
export type TProject = { | ||
title: string; | ||
description: string; | ||
image: string; | ||
link: string; | ||
linkToGH?: string; | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.