Skip to content

Commit b26a2f4

Browse files
authored
Merge pull request #9 from Kyle-Winn/initial-flip-card
Initial flip card
2 parents d74d9b8 + 82b8a77 commit b26a2f4

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

src/components/FlippableCard.tsx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ const FlippableCard = ({ frontContent, backContent }: FlippableCardProps) => {
7676
const [isFlipped, setIsFlipped] = useState(false)
7777
const [isHovered, setIsHovered] = useState(false)
7878
const [isMerged, setIsMerged] = useState(true)
79+
const [initialFlipComplete, setInitialFlipComplete] = useState(false)
7980

8081
const ref = useRef<HTMLDivElement>(null)
8182
const anchorRef = useRef<HTMLDivElement>(null)
@@ -88,6 +89,9 @@ const FlippableCard = ({ frontContent, backContent }: FlippableCardProps) => {
8889

8990
const controls = useAnimation()
9091

92+
const INITIAL_FLIP_DELAY_MS = 3000
93+
const JIGGLE_ANIMATION_DELAY_MS = 750
94+
9195
const zoom = useSpring(1, {
9296
duration: 0.1,
9397
damping: 7,
@@ -99,10 +103,26 @@ const FlippableCard = ({ frontContent, backContent }: FlippableCardProps) => {
99103
}, [rotateX, rotateY])
100104

101105
useEffect(() => {
102-
// Start the jiggle animation when not hovered
103-
setTimeout(() => controls.start(jiggleAnimation), 750)
106+
// Flip the card on initial load
107+
setIsFlipped(true)
108+
109+
const timer = setTimeout(() => {
110+
setIsFlipped(false)
111+
setInitialFlipComplete(true)
112+
}, INITIAL_FLIP_DELAY_MS)
113+
114+
return () => clearTimeout(timer)
104115
}, [])
105116

117+
useEffect(() => {
118+
if (!initialFlipComplete) return
119+
120+
// Start the jiggle animation when not hovered
121+
const timer = setTimeout(() => controls.start(jiggleAnimation), JIGGLE_ANIMATION_DELAY_MS)
122+
123+
return () => clearTimeout(timer)
124+
}, [initialFlipComplete, controls])
125+
106126
const handleMouseMove = (event: React.MouseEvent<HTMLDivElement>) => {
107127
const element = ref.current
108128

src/constants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ const NEXT_MEETUPS_SERIES: MeetupDetails[] = [{
4141
date: new Date('2025-03-27T17:00:00'),
4242
location: 'AT_2.07',
4343
description: 'Share your projects and get feedback from the community!',
44+
}, {
45+
title: 'Project Share',
46+
date: new Date('2025-09-19T16:00:00'),
47+
location: 'AT_2.07',
48+
description: 'Share your projects and get feedback from the community!',
4449
}]
4550

4651
export const NEXT_MEETUP: MeetupDetails | undefined = NEXT_MEETUPS_SERIES.find((meetup) => meetup.date >= new Date())

0 commit comments

Comments
 (0)