-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathHome.tsx
More file actions
53 lines (45 loc) · 1.94 KB
/
Home.tsx
File metadata and controls
53 lines (45 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { useNavigate } from 'react-router-dom';
import { HomeContainer } from '@/page/home/Home.css';
import { INTRO_MESSAGE } from '@/page/home/constant/scrollSection';
import { useFadeInOnView } from '@/page/home/hook/useFadeInOnView';
import StartSection from '@/page/home/StartSection/StartSection';
import ScrollSection from '@/page/home/ScrollSection/ScrollSection';
import EndSection from '@/page/home/EndSection/EndSection';
import { fadeSlide } from '@/page/home/style/fadeTransition.css';
import { useMultipleFadeInOnView } from '@/page/home/hook/useMultipleFadeInOnView';
import mandalAnimation from '@/assets/lottie/mandalart.json';
import aiAnimation from '@/assets/lottie/ai.json';
import todoAnimation from '@/assets/lottie/todo.json';
import { useModal } from '@/common/hook/useModal';
import LoginModal from '@/common/component/LoginModal/LoginModal';
const animationDataArray = [mandalAnimation, aiAnimation, todoAnimation];
const sectionKeys = ['mandalart', 'ai', 'todo'] as const;
const Home = () => {
const scrolls = useMultipleFadeInOnView();
const end = useFadeInOnView<HTMLDivElement>();
const { openModal, closeModal, ModalWrapper } = useModal();
const handleOpenLogin = () => {
openModal(<LoginModal onClose={closeModal} />);
};
return (
<div className={HomeContainer}>
<StartSection onClick={handleOpenLogin} />
{sectionKeys.map((key, index) => {
const { ref, visible } = scrolls[index];
return (
<div key={key} ref={ref} className={fadeSlide({ state: visible ? 'in' : 'out' })}>
<ScrollSection
title={INTRO_MESSAGE[key].title}
content={INTRO_MESSAGE[key].content}
index={index}
animationData={animationDataArray[index]}
/>
</div>
);
})}
<EndSection fadeInRef={end.ref} visible={end.visible} onClick={handleOpenLogin} />
{ModalWrapper}
</div>
);
};
export default Home;