-
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
1 parent
321767f
commit d052b3c
Showing
5 changed files
with
290 additions
and
118 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
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 |
---|---|---|
@@ -0,0 +1,114 @@ | ||
import { useEffect, useRef } from 'react' | ||
|
||
const AnimatedImageGallery = () => { | ||
const imageRefs = [useRef<HTMLDivElement>(null), useRef<HTMLDivElement>(null)] | ||
|
||
useEffect(() => { | ||
if (window.innerWidth >= 640) return | ||
|
||
const observers = imageRefs.map((ref, index) => { | ||
const threshold = 0.5 - index * 0.1 | ||
|
||
const observer = new IntersectionObserver( | ||
(entries) => { | ||
entries.forEach((entry) => { | ||
if (entry.isIntersecting) { | ||
setTimeout(() => { | ||
if (ref.current) { | ||
ref.current.classList.remove( | ||
'opacity-0', | ||
'translate-x-8', | ||
'-translate-x-8', | ||
) | ||
ref.current.classList.add('opacity-100', 'translate-x-0') | ||
} | ||
}, index * 100) | ||
observer.unobserve(entry.target) | ||
} | ||
}) | ||
}, | ||
{ | ||
threshold, | ||
rootMargin: '0px 0px -10% 0px', | ||
}, | ||
) | ||
|
||
if (ref.current) { | ||
observer.observe(ref.current) | ||
} | ||
|
||
return observer | ||
}) | ||
|
||
return () => { | ||
observers.forEach((observer) => observer.disconnect()) | ||
} | ||
}, []) | ||
|
||
return ( | ||
<> | ||
<div className="ml-auto w-44 flex-none space-y-8 pt-32 sm:ml-0 sm:pt-80 lg:order-last lg:pt-36 xl:order-none xl:pt-80"> | ||
<div className="relative"> | ||
<img | ||
alt="" | ||
src="/about/1.webp" | ||
className="hidden aspect-[2/3] w-full rounded-xl bg-gray-900/5 object-cover shadow-lg sm:block" | ||
/> | ||
<div className="pointer-events-none absolute inset-0 rounded-xl ring-1 ring-inset ring-gray-900/10" /> | ||
</div> | ||
</div> | ||
<div className="mr-auto w-44 flex-none space-y-8 sm:mr-0 sm:pt-52 lg:pt-36"> | ||
<div className="relative"> | ||
<div className="sm:transform-none sm:opacity-100"> | ||
<img | ||
alt="" | ||
src="/about/2.webp" | ||
className="aspect-[2/3] w-full rounded-xl bg-gray-900/5 object-cover shadow-lg" | ||
/> | ||
<div className="pointer-events-none absolute inset-0 rounded-xl ring-1 ring-inset ring-gray-900/10" /> | ||
</div> | ||
</div> | ||
<div className="relative"> | ||
<div | ||
ref={imageRefs[0]} | ||
className="-translate-x-8 transform opacity-0 transition-all duration-700 ease-out sm:transform-none sm:opacity-100" | ||
> | ||
<img | ||
alt="" | ||
src="/about/3.webp" | ||
className="aspect-[2/3] w-full rounded-xl bg-gray-900/5 object-cover shadow-lg" | ||
/> | ||
<div className="pointer-events-none absolute inset-0 rounded-xl ring-1 ring-inset ring-gray-900/10" /> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="w-44 flex-none space-y-8 pt-32 sm:pt-0"> | ||
<div className="relative"> | ||
<div className="sm:transform-none sm:opacity-100"> | ||
<img | ||
alt="" | ||
src="/about/4.webp" | ||
className="aspect-[2/3] w-full rounded-xl bg-gray-900/5 object-cover shadow-lg" | ||
/> | ||
<div className="pointer-events-none absolute inset-0 rounded-xl ring-1 ring-inset ring-gray-900/10" /> | ||
</div> | ||
</div> | ||
<div className="relative"> | ||
<div | ||
ref={imageRefs[1]} | ||
className="translate-x-8 transform opacity-0 transition-all duration-700 ease-out sm:transform-none sm:opacity-100" | ||
> | ||
<img | ||
alt="" | ||
src="/about/5.webp" | ||
className="aspect-[2/3] w-full rounded-xl bg-gray-900/5 object-cover shadow-lg" | ||
/> | ||
<div className="pointer-events-none absolute inset-0 rounded-xl ring-1 ring-inset ring-gray-900/10" /> | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
) | ||
} | ||
|
||
export default AnimatedImageGallery |
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,75 @@ | ||
import { useEffect, useRef } from 'react' | ||
|
||
interface TeamMember { | ||
name: string | ||
role: string | ||
imageUrl: string | ||
href: string | ||
} | ||
|
||
interface AnimatedTeamMemberProps { | ||
person: TeamMember | ||
} | ||
|
||
const AnimatedTeamMembers = ({ person }: AnimatedTeamMemberProps) => { | ||
const memberRef = useRef<HTMLLIElement>(null) | ||
|
||
useEffect(() => { | ||
if (window.innerWidth >= 640) return | ||
|
||
const observer = new IntersectionObserver( | ||
(entries) => { | ||
entries.forEach((entry) => { | ||
if (entry.isIntersecting) { | ||
if (memberRef.current) { | ||
memberRef.current.classList.remove('opacity-0', 'translate-y-8') | ||
memberRef.current.classList.add('opacity-100', 'translate-y-0') | ||
} | ||
observer.unobserve(entry.target) | ||
} | ||
}) | ||
}, | ||
{ | ||
threshold: 0.2, | ||
rootMargin: '0px 0px -10% 0px', | ||
}, | ||
) | ||
|
||
if (memberRef.current) { | ||
observer.observe(memberRef.current) | ||
} | ||
|
||
return () => { | ||
observer.disconnect() | ||
} | ||
}, []) | ||
|
||
return ( | ||
<li | ||
ref={memberRef} | ||
className="translate-y-8 transform opacity-0 transition-all duration-700 ease-out sm:transform-none sm:opacity-100" | ||
> | ||
<div className="flex items-center gap-x-6"> | ||
<div className="group flex items-center gap-x-6"> | ||
<a target="_blank" href={person.href}> | ||
<img | ||
alt="" | ||
src={person.imageUrl} | ||
className="size-16 rounded-full" | ||
/> | ||
</a> | ||
<div> | ||
<h3 className="text-base/7 font-semibold tracking-tight text-gray-900"> | ||
{person.name} | ||
</h3> | ||
<p className="bg-gradient-to-r from-[#ff8a5b] from-[28%] via-[#fe7e98] via-[70%] to-[#f984ff] bg-clip-text text-sm/6 font-normal text-transparent"> | ||
{person.role} | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</li> | ||
) | ||
} | ||
|
||
export default AnimatedTeamMembers |
Oops, something went wrong.