1- import React , { useState , useEffect } from 'react' ;
2- import Image from 'next/image' ;
3- import gsap from 'gsap' ;
1+ import React , { useState , useEffect } from 'react'
2+ import Image from 'next/image'
3+ import gsap from 'gsap'
44
5- import seminar from '@public/images/activity/seminar.jpg' ;
6- import snack from '@public/images/activity/snack.jpg' ;
7- import party from '@public/images/activity/party.jpg' ;
8- import conf from '@public/images/activity/conf.jpg' ;
9- import googleconf from '@public/images/activity/googleconf.jpg' ;
10- import christmas from '@public/images/activity/christmas.jpg' ;
5+ import seminar from '@public/images/activity/seminar.jpg'
6+ import snack from '@public/images/activity/snack.jpg'
7+ import party from '@public/images/activity/party.jpg'
8+ import conf from '@public/images/activity/conf.jpg'
9+ import googleconf from '@public/images/activity/googleconf.jpg'
10+ import christmas from '@public/images/activity/christmas.jpg'
1111
1212function ActivitiesSection ( ) {
13+ const [ hoveredCard , setHoveredCard ] = useState ( 1 )
1314
14- const [ hoveredCard , setHoveredCard ] = useState ( 1 ) ;
15+ const handleMouseEnter = ( cardIndex ) => {
16+ setHoveredCard ( cardIndex )
17+ }
1518
16- const handleMouseEnter = ( cardIndex ) => {
17- setHoveredCard ( cardIndex ) ;
18- } ;
19+ const handleMouseLeave = ( ) => {
20+ setHoveredCard ( null )
21+ }
1922
20- const handleMouseLeave = ( ) => {
21- setHoveredCard ( null ) ;
22- } ;
23+ const cards = [
24+ { title : '연사자 초청' , description : '실전활용도 높은 온/오프 강연' , image : seminar } ,
25+ { title : '간식드리미' , description : '정성 가득 시험기간 간식드리미' , image : snack } ,
26+ { title : '네트워킹 행사' , description : 'MT/한강/잔막 등 다같이 외부 나들이' , image : party } ,
27+ { title : '내부 행사' , description : '자체•연합 해커톤 주최 및 참여' , image : conf } ,
28+ {
29+ title : '외부 행사' ,
30+ description : 'Google 등 IT기업의 네트워킹/레퍼런스 참여' ,
31+ image : googleconf
32+ } ,
33+ { title : '크리스마스 파티' , description : '연말 파티와 함께하는 네트워킹' , image : christmas }
34+ ]
2335
24- const cards = [
25- { title : '연사자 초청' , description : '실전활용도 높은 온/오프 강연' , image : seminar } ,
26- { title : '간식드리미' , description : '정성 가득 시험기간 간식드리미' , image : snack } ,
27- { title : '네트워킹 행사' , description : 'MT/한강/잔망 등 다같이 외부 나들이' , image : party } ,
28- { title : '내부 행사' , description : '자체•연합 해커톤 주최 및 참여' , image : conf } ,
29- { title : '외부행사' , description : 'Google 등 IT기업의 네트워킹/레퍼런스 참여' , image : googleconf } ,
30- { title : '크리스마스 파티' , description : '연말 파티와 함께하는 네트워킹' , image : christmas } ,
31- ]
36+ useEffect ( ( ) => {
37+ gsap . fromTo (
38+ '#cards' ,
39+ {
40+ y : 90 ,
41+ opacity : 0
42+ } ,
43+ {
44+ y : 0 ,
45+ opacity : 1 ,
46+ duration : 1 ,
47+ delay : 0.5 ,
48+ ease : 'power2.out' ,
49+ scrollTrigger : {
50+ trigger : '#section4' ,
51+ start : 'top center' ,
52+ toggleActions : 'play none none reverse'
53+ }
54+ }
55+ )
56+ } , [ ] )
3257
33-
34- useEffect ( ( ) => {
35- gsap . fromTo (
36- '#cards' ,
37- {
38- y : 90 ,
39- opacity : 0 ,
40- } ,
41- {
42- y : 0 ,
43- opacity : 1 ,
44- duration : 1 ,
45- delay : 0.5 ,
46- ease : 'power2.out' ,
47- scrollTrigger : {
48- trigger : '#section4' ,
49- start : 'top center' ,
50- toggleActions : 'play none none reverse' ,
51- } ,
52- }
53- ) ;
54- } , [ ] ) ;
55-
56-
57- return (
58- < div id = 'section4' className = 'flex flex-col h-full w-full justify-center' >
59- < div className = 'text-white text-[3.5vw] mobile:text-[6vw] mobile:mx-[20px] font-semibold mt-96 text-center' >
60- < div className = 'text-[70px] mobile:text-[26vw]' > ❓</ div >
61- < div className = 'text-[2.5vw] mobile:text-[4vw]' > 합류하면 어떤 활동들을 할 수 있나요?</ div >
62- </ div >
63- < div id = 'cards' className = 'flex flex-col w-full h-full mt-36 mb-36 opacity-0' >
64- < div className = 'grid grid-cols-3 mobile:grid-cols-2 gap-5 px-28 tablet:px-30 mobile:px-4' >
65- { cards . map ( ( card , index ) => (
66- < div
67- id = 'card'
68- key = { index }
69- className = 'group relative w-full h-[300px] rounded-2xl overflow-hidden'
70- onMouseEnter = { ( ) => handleMouseEnter ( index ) }
71- onMouseLeave = { handleMouseLeave }
72- >
73- < div className = "w-full h-full relative" >
74- < Image
75- src = { card . image }
76- alt = { card . title }
77- fill
78- className = 'w-auto h-auto object-cover transition-transform duration-300 group-hover:scale-110 z-0'
79- />
80- < div
81- className = { `absolute inset-0 bg-black/70 transition-opacity duration-300 flex items-center justify-center z-10
58+ return (
59+ < div id = "section4" className = "flex flex-col h-full w-full justify-center" >
60+ < div className = "text-white text-[3.5vw] mobile:text-[6vw] mobile:mx-[20px] font-semibold mt-96 text-center" >
61+ < div className = "text-[70px] mobile:text-[26vw]" > ❓</ div >
62+ < div className = "text-[2.5vw] mobile:text-[4vw]" > 합류하면 어떤 활동들을 할 수 있나요?</ div >
63+ </ div >
64+ < div id = "cards" className = "flex flex-col w-full h-full mt-36 mb-36 opacity-0" >
65+ < div className = "grid grid-cols-3 mobile:grid-cols-2 gap-5 px-28 tablet:px-30 mobile:px-4" >
66+ { cards . map ( ( card , index ) => (
67+ < div
68+ id = "card"
69+ key = { index }
70+ className = "group relative w-full h-[300px] rounded-2xl overflow-hidden"
71+ onMouseEnter = { ( ) => handleMouseEnter ( index ) }
72+ onMouseLeave = { handleMouseLeave }
73+ >
74+ < div className = "w-full h-full relative" >
75+ < Image
76+ src = { card . image }
77+ alt = { card . title }
78+ fill
79+ className = "w-auto h-auto object-cover transition-transform duration-300 group-hover:scale-110 z-0"
80+ />
81+ < div
82+ className = { `absolute inset-0 bg-black/70 transition-opacity duration-300 flex items-center justify-center z-10
8283 ${ hoveredCard === index ? 'opacity-100' : 'opacity-0' } ` }
83- >
84- < div className = 'text-white text-center p-6' >
85- < h3 className = 'text-[2.5vw] font-bold mb-2 mobile:text-[4vw]' > { card . title } </ h3 >
86- < p className = 'text-[1.5vw] mobile:text-[4vw]' > { card . description } </ p >
87- </ div >
88- </ div >
89- </ div >
90- </ div >
91- ) ) }
84+ >
85+ < div className = "text-white text-center p-6" >
86+ < h3 className = "text-[2.5vw] font-bold mb-2 mobile:text-[4vw]" > { card . title } </ h3 >
87+ < p className = "text-[1.5vw] mobile:text-[4vw]" > { card . description } </ p >
88+ </ div >
9289 </ div >
90+ </ div >
9391 </ div >
92+ ) ) }
9493 </ div >
95- ) ;
94+ </ div >
95+ </ div >
96+ )
9697}
9798
98- export default ActivitiesSection ;
99+ export default ActivitiesSection
0 commit comments