-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMainPage.tsx
More file actions
68 lines (61 loc) · 2.24 KB
/
Copy pathMainPage.tsx
File metadata and controls
68 lines (61 loc) · 2.24 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { ROUTES } from '@shared/constants';
import { useAuthStore } from '@shared/stores';
import { BannerCard } from '@shared/ui/BannerCard';
import { Carousel3D } from '@shared/ui/Carousel3D';
import { ChatbotFloatingButton } from '@shared/ui/ChatbotFloatingButton';
import { ClientOnly } from '@shared/ui/ClientOnly';
import { Modal } from '@shared/ui/Modal';
import { useState } from 'react';
import { useNavigate } from 'react-router';
import { BANNER_CARDS } from './BannerCards';
import { CAROUSEL_SLIDES } from './CarouselSlides';
const MainPage = () => {
const navigate = useNavigate();
const { accessToken } = useAuthStore();
const [showLoginModal, setShowLoginModal] = useState(false);
const handleChatbotClick = () => {
if (!accessToken) {
setShowLoginModal(true);
return;
}
navigate(ROUTES.CHATBOT, { viewTransition: true });
};
return (
<main className="md:px-xxxl flex w-full flex-col items-center gap-6 px-(--margin-l) md:gap-10 lg:gap-[68px] lg:px-0">
<section className="h-[317px] w-full max-w-[1200px]" aria-label="메인 슬로건 영역">
<ClientOnly>
<Carousel3D slides={CAROUSEL_SLIDES} />
</ClientOnly>
</section>
<section className="grid w-full max-w-[1200px] grid-cols-1 gap-6 xl:grid-cols-3" aria-label="서비스 배너 영역">
{BANNER_CARDS.map((card) => (
<BannerCard
key={card.id}
title={card.title}
description={card.description}
imageSrc={card.imageSrc}
onClick={() => navigate(card.route, { viewTransition: true })}
/>
))}
</section>
<ChatbotFloatingButton
className="fixed right-[calc(1rem+var(--scrollbar-width))] bottom-4"
onClick={handleChatbotClick}
/>
{showLoginModal && (
<Modal
title="로그인이 필요합니다"
subtitle="로그인 페이지로 이동하시겠습니까?"
cancelText="취소"
confirmText="로그인"
onCancel={() => setShowLoginModal(false)}
onConfirm={() => {
setShowLoginModal(false);
navigate(ROUTES.LOGIN, { viewTransition: true });
}}
/>
)}
</main>
);
};
export default MainPage;