11import { HomeContainer } from '@/page/home/Home.css' ;
2- import { INTRO_MESSAGE } from '@/page/home/constant/scrollSection ' ;
2+ import { INTRO_MESSAGE } from '@/page/home/constant/messageConstants ' ;
33import { useFadeInOnView } from '@/page/home/hook/useFadeInOnView' ;
4- import StartSection from '@/page/home/StartSection/StartSection' ;
5- import ScrollSection from '@/page/home/ScrollSection/ScrollSection' ;
6- import EndSection from '@/page/home/EndSection/EndSection' ;
4+ import { StartSection , EndSection } from '@/page/home' ;
75import { fadeSlide } from '@/page/home/style/fadeTransition.css' ;
86import { useMultipleFadeInOnView } from '@/page/home/hook/useMultipleFadeInOnView' ;
9- import mandalAnimation from '@/assets/lottie/mandalart.json' ;
10- import aiAnimation from '@/assets/lottie/ai.json' ;
11- import todoAnimation from '@/assets/lottie/todo.json' ;
127import { useOverlayModal } from '@/common/hook/useOverlayModal' ;
138import LoginModal from '@/common/component/LoginModal/LoginModal' ;
9+ import ScrollSection from '@/page/home/ScrollSection/ScrollSection' ;
10+ import type { AnimationImporter } from '@/page/home/type/lottieType' ;
11+
12+ const animationImporters = [
13+ ( ) => import ( '@/assets/lottie/mandalart.json' ) ,
14+ ( ) => import ( '@/assets/lottie/ai.json' ) ,
15+ ( ) => import ( '@/assets/lottie/todo.json' ) ,
16+ ] as const satisfies readonly AnimationImporter [ ] ;
1417
15- const animationDataArray = [ mandalAnimation , aiAnimation , todoAnimation ] ;
1618const sectionKeys = [ 'mandalart' , 'ai' , 'todo' ] as const ;
1719
1820const Home = ( ) => {
1921 const scrolls = useMultipleFadeInOnView ( ) ;
2022 const end = useFadeInOnView < HTMLDivElement > ( ) ;
21-
2223 const { openModal, closeModal } = useOverlayModal ( ) ;
2324
24- const handleOpenLogin = ( ) => {
25- openModal ( < LoginModal onClose = { closeModal } /> ) ;
26- } ;
25+ const handleOpenLogin = ( ) => openModal ( < LoginModal onClose = { closeModal } /> ) ;
2726
2827 return (
2928 < div className = { HomeContainer } >
3029 < StartSection onClick = { handleOpenLogin } />
3130
3231 { sectionKeys . map ( ( key , index ) => {
3332 const { ref, visible } = scrolls [ index ] ;
33+ const direction = index % 2 === 1 ? 'right' : ( 'left' as const ) ;
34+
3435 return (
3536 < div key = { key } ref = { ref } className = { fadeSlide ( { state : visible ? 'in' : 'out' } ) } >
3637 < ScrollSection
3738 title = { INTRO_MESSAGE [ key ] . title }
3839 content = { INTRO_MESSAGE [ key ] . content }
39- index = { index }
40- animationData = { animationDataArray [ index ] }
40+ visible = { visible }
41+ direction = { direction }
42+ animationImporter = { animationImporters [ index ] }
4143 />
4244 </ div >
4345 ) ;
@@ -47,4 +49,5 @@ const Home = () => {
4749 </ div >
4850 ) ;
4951} ;
52+
5053export default Home ;
0 commit comments