-
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.
Merge pull request #1 from La-404-Devinci/projects-animation
add: forum associatif project + projects animation with framer motion
- Loading branch information
Showing
7 changed files
with
96 additions
and
13 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,61 @@ | ||
"use client"; | ||
|
||
import cn from "@/utils/function"; | ||
import { motion } from "framer-motion"; | ||
import Image from "next/image"; | ||
import { useState } from "react"; | ||
|
||
interface ProjectProps { | ||
project: { | ||
name: string; | ||
date: string; | ||
image: string; | ||
}; | ||
index: number; | ||
} | ||
|
||
const anim = { | ||
initial: {width: 0}, | ||
open: {width: "auto", transition: {duration: 0.4, ease: [0.23, 1, 0.32, 1]}}, | ||
closed: {width: 0} | ||
} | ||
|
||
const Project = ({ project, index }: ProjectProps) => { | ||
|
||
const [isActive, setIsActive] = useState(false); | ||
|
||
return ( | ||
<div | ||
key={`project:${index}`} | ||
className={cn( | ||
"h-40 flex items-center justify-between p-8", | ||
index === 0 | ||
? "border-t border-b border-gray-800" | ||
: "border-b border-gray-800" | ||
)} | ||
onMouseEnter={() => {setIsActive(true)}} | ||
onMouseLeave={() => {setIsActive(false)}} | ||
> | ||
<div className="flex items-center gap-8 justify-center"> | ||
<h3 className="text-6xl text-gray-50 font-medium">{project.name}</h3> | ||
<motion.div | ||
variants={anim} | ||
animate={isActive ? "open" : "closed"} | ||
className="overflow-hidden origin-center flex justify-center" | ||
> | ||
<Image | ||
src={`/img/${project.image}`} | ||
alt={project.name} | ||
width={0} | ||
height={0} | ||
sizes="208px" | ||
className="w-52 max-w-none" | ||
/> | ||
</motion.div> | ||
</div> | ||
<p className="text-gray-400">{project.date}</p> | ||
</div> | ||
); | ||
} | ||
|
||
export default Project; |
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