Skip to content

Commit 006bb6f

Browse files
authored
Merge pull request #95 from wafflestudio/seoyeon
로그인 모달 관련 변경사항들
2 parents b956770 + 993e655 commit 006bb6f

9 files changed

Lines changed: 92 additions & 38 deletions

File tree

src/pages/MainDay.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect } from "react";
1+
import { useEffect, useState } from "react";
22
import { useNavigate } from "react-router-dom";
33
import styles from "@styles/CalendarView.module.css";
44
import MonthSideView from "@widgets/Month/MonthSideView/MonthSideView";
@@ -7,13 +7,16 @@ import BottomNav from "@/widgets/BottomNav";
77
import { useEvents } from "@/contexts/EventContext";
88
import { useDetail } from "@/contexts/DetailContext";
99
import { FilterSheet } from "@/widgets/FilterSheet/FilterSheet";
10+
import Modal from "@/widgets/Modal";
1011

1112
const MOBILE_MAX_WIDTH = 576;
1213

1314
const MainDay = () => {
1415
const navigate = useNavigate();
1516
const { dayDate } = useEvents();
1617
const { showDetail, clickedEventId } = useDetail();
18+
const [isLoginModalOpen, setIsLoginModalOpen] = useState(false);
19+
1720

1821
useEffect(() => {
1922
const checkWidth = () => {
@@ -33,7 +36,7 @@ const MainDay = () => {
3336
return (
3437
<div className={`${styles.container} ${styles.mainDay}`}>
3538
<div className={styles.calendarContainer}>
36-
<MonthSideView day={dayDate} onClose={handleClose} />
39+
<MonthSideView day={dayDate} onClose={handleClose} onLoginPrompt={()=>setIsLoginModalOpen(true)} />
3740
{showDetail && clickedEventId !== undefined && (
3841
<div className={`${styles.sidePanel} ${styles.detailPanel}`}>
3942
<DetailView eventId={clickedEventId} />
@@ -42,6 +45,17 @@ const MainDay = () => {
4245
</div>
4346
<FilterSheet />
4447
{!showDetail && <BottomNav />}
48+
{isLoginModalOpen && (
49+
<Modal
50+
content="로그인 이후 이용해주세요"
51+
leftText="로그인"
52+
rightText="닫기"
53+
onLeftClick={() => navigate("/")}
54+
onRightClick={() => setIsLoginModalOpen(false)}
55+
onClose={() => setIsLoginModalOpen(false)}
56+
/>
57+
)}
58+
4559
</div>
4660
);
4761
};

src/pages/MyPage.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,9 @@ const MyPage = () => {
390390
) : (
391391
<div className={styles.notFound}>
392392
<Modal
393-
content="마이페이지 이용을 위해서는 로그인을 해주세요."
394-
leftText="로그인"
395-
rightText="회원가입"
396-
onLeftClick={() => navigate("/auth/login")}
397-
onRightClick={() => navigate("/auth/signup")}
393+
content={"마이페이지 이용을 위해서는\n로그인이 필요해요."}
394+
leftText="로그인 · 회원가입 페이지로 이동"
395+
onLeftClick={() => navigate("/")}
398396
onClose={null}
399397
/>
400398
</div>

src/pages/bookmark/Bookmark.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const BookmarksPage = () => {
5353
className={styles.backBtn}
5454
color="ABABAB"
5555
size={18}
56-
onClick={() => navigate("/my")}
56+
onClick={() => (window.history.length > 1 ? navigate(-1) : navigate("/my"))}
5757
/>
5858
<div className={styles.row}>
5959
<span>내 찜 목록</span>

src/pages/memo/Memo.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,9 @@ const MemoPage = () => {
7777
return (<div className={styles.notFound}>
7878
<Navigationbar />
7979
<Modal
80-
content="메모 이용을 위해서는 로그인을 해주세요."
81-
leftText="로그인"
82-
rightText="회원가입"
83-
onLeftClick={() => navigate("/auth/login")}
84-
onRightClick={() => navigate("/auth/signup")}
80+
content={"메모 이용을 위해서는\n로그인이 필요해요."}
81+
leftText="로그인 ·회원가입 페이지로 이동"
82+
onLeftClick={() => navigate("/")}
8583
onClose={null}
8684
/>
8785
<BottomNav />

src/pages/timetable/TimetablePage.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,9 @@ export default function TimetablePage() {
255255
{!user &&
256256
<div className={styles.notFound}>
257257
<Modal
258-
content="시간표 페이지 이용을 위해서는 로그인을 해주세요."
259-
leftText="로그인"
260-
rightText="회원가입"
261-
onLeftClick={() => navigate("/auth/login")}
262-
onRightClick={() => navigate("/auth/signup")}
258+
content={"시간표 페이지 이용을 위해서는\n로그인이 필요해요."}
259+
leftText="로그인 ·회원가입 페이지로 이동"
260+
onLeftClick={() => navigate("/")}
263261
onClose={null}
264262
/>
265263
</div>

src/styles/Modal.module.css

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
left: 50%;
99
transform: translate(-50%, -50%);
1010

11-
background-color: #faf9f6;
12-
padding: 50px 40px 30px 40px;
11+
background-color: #fbfbff;
12+
padding: 40px 20px 30px 20px;
1313

14-
border: 1px solid rgb(220, 220, 220);
15-
border-radius: 18px;
14+
border: 1px solid rgb(204, 204, 204);
15+
border-radius: 10px;
1616

1717
min-width: 300px;
18-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.131);
18+
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05);
1919
}
2020

2121
.modalWrapper {
@@ -24,7 +24,7 @@
2424
justify-content: center;
2525
align-items: center;
2626

27-
gap: 20px;
27+
gap: 15px;
2828
z-index: 40;
2929

3030
position: relative;
@@ -40,11 +40,12 @@
4040
}
4141

4242
.modalContent {
43-
font-size: 18px;
44-
font-weight: 500;
43+
font-size: 17px;
44+
font-weight: 600;
4545
word-break: keep-all;
4646
overflow-wrap: break-word;
4747
text-align: center;
48+
white-space: pre-line;
4849
}
4950

5051
.buttonsRow {
@@ -58,26 +59,57 @@
5859
.buttonsRow > button {
5960
font-size: 16px;
6061
font-weight: 600;
61-
padding: 10px 15px;
62-
border-radius: 15px;
62+
padding: 10px 20px;
63+
border-radius: 10px;
6364
cursor: pointer;
6465
}
6566

6667
.leftBtn {
67-
background-color: #494949;
68+
background-color: #4d80e8;
6869
color: white;
6970
border: none;
7071
}
7172

73+
.linkBtn {
74+
background: none;
75+
border: none;
76+
text-decoration: underline;
77+
cursor: pointer;
78+
display: flex;
79+
gap: 5px;
80+
color: #4d80e8;
81+
}
82+
7283
.leftBtn:hover {
73-
background-color: #303030;
84+
background-color: #406cc3;
7485
}
7586

7687
.rightBtn {
88+
color: #4d80e8;
7789
background-color: rgb(255, 255, 255);
78-
border: 1px solid #d9d9d9;
90+
border: 1px solid #7699df;
7991
}
8092

8193
.rightBtn:hover {
8294
background-color: rgb(223, 223, 223);
8395
}
96+
97+
@media (max-width: 612px) {
98+
.modalContainer {
99+
padding: 40px 15px 30px 15px;
100+
}
101+
}
102+
103+
@media (max-width: 360px) {
104+
.modalContainer {
105+
padding: 30px 5px 20px 5px;
106+
}
107+
.modalContent {
108+
font-size: 16px;
109+
}
110+
.linkBtn,
111+
.leftBtn,
112+
.rightBtn {
113+
font-size: 16px;
114+
}
115+
}

src/widgets/Modal.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import styles from "@styles/Modal.module.css";
2+
import { FaExternalLinkAlt } from "react-icons/fa";
23
import { IoIosClose } from "react-icons/io";
34

45
interface ModalProps {
56
content: string;
67
leftText: string;
7-
rightText: string;
8+
rightText?: string | null;
89
onLeftClick: () => void;
9-
onRightClick: () => void;
10+
onRightClick?: (() => void) | null;
1011
onClose: (() => void) | null;
1112
}
1213

@@ -33,19 +34,23 @@ const Modal = ({
3334
<span className={styles.modalContent}>{content}</span>
3435
<div className={styles.buttonsRow}>
3536
<button
36-
className={styles.leftBtn}
37+
className={`${rightText ? styles.leftBtn : styles.linkBtn}`}
3738
type="button"
3839
onClick={onLeftClick}
3940
>
40-
{leftText}
41+
{!rightText &&
42+
<FaExternalLinkAlt />
43+
}
44+
<span>{leftText}</span>
4145
</button>
46+
{rightText && onRightClick &&
4247
<button
4348
className={styles.rightBtn}
4449
type="button"
4550
onClick={onRightClick}
4651
>
4752
{rightText}
48-
</button>
53+
</button>}
4954
</div>
5055
</div>
5156
</div>

src/widgets/Month/MonthSideView/CardView.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { CATEGORY_COLORS, CATEGORY_LIST } from "@constants";
55
import type { Event } from "@types";
66
import { useUserData } from "@/contexts/UserDataContext";
77
import { StartDate } from "@/widgets/EventDate";
8+
import { useAuth } from "@/contexts/AuthProvider";
89

910
const MobileChipsList = ({ event }: { event: Event }) => {
1011
const ddayTargetDate = event.applyEnd;
@@ -55,8 +56,9 @@ const MobileChipsList = ({ event }: { event: Event }) => {
5556
)
5657
}
5758

58-
const CardView = ({ event }: { event: Event }) => {
59+
const CardView = ({ event, onLoginPrompt }: { event: Event; onLoginPrompt: () => void; }) => {
5960
const ddayTargetDate = event.applyEnd;
61+
const {user} = useAuth();
6062

6163
const [isBookmarked, setIsBookmarked] = useState<boolean>(
6264
event.isBookmarked || false,
@@ -69,6 +71,11 @@ const CardView = ({ event }: { event: Event }) => {
6971
const previousState = isBookmarked;
7072
e.stopPropagation();
7173

74+
if (!user) {
75+
onLoginPrompt();
76+
return;
77+
}
78+
7279
// optimistic update
7380
setIsBookmarked(!previousState);
7481

src/widgets/Month/MonthSideView/MonthSideView.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ import { FilterButton } from "@/widgets/Toolbar";
1616
const MonthSideView = ({
1717
day,
1818
onClose,
19+
onLoginPrompt,
1920
}: {
2021
day: Date;
2122
onClose: () => void;
23+
onLoginPrompt: () => void;
2224
}) => {
2325
const { setShowDetail, setClickedEventId } = useDetail();
2426
const [date, setDate] = useState<Date>(day);
@@ -110,7 +112,7 @@ const MonthSideView = ({
110112
onKeyDown={(e) => e.key === "Enter" && handleDetailClick(event.id)}
111113
className={styles.cardButton}
112114
>
113-
<CardView key={event.id} event={event} />
115+
<CardView key={event.id} event={event} onLoginPrompt={onLoginPrompt} />
114116
</div>
115117
))}
116118
</div>

0 commit comments

Comments
 (0)