Skip to content

Commit 3f39a35

Browse files
committed
Merge branch 'dev' of https://github.com/MBTips/FE-MBTips into feat/Header-고정-작업
2 parents 87d434a + c436e94 commit 3f39a35

File tree

11 files changed

+109
-52
lines changed

11 files changed

+109
-52
lines changed

src/components/ChatActionBar.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ChangeEvent, KeyboardEvent } from "react";
22
import ToggleChatTipsButton from "@/components/button/ToggleChatTipsButton";
33
import MessageInput from "@/components/input/MessageInput";
4+
import TipsMenuContainer from "@/components/tips/TipsMenuContainer";
45

56
interface ChatActionProps {
67
isOpen: boolean;

src/components/StrokeBanner.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ const StrokeBanner = () => {
2323
친구 정보를 저장하고 대화할 수 있어요
2424
</strong>
2525
<p className="mt-2 text-sm font-light text-gray-900">
26-
로그인 시 기억하고 싶은 친구의 MBTI와 특징을 입력해서 빠르게 대화할 수
27-
있어요
26+
로그인 시 기억하고 싶은 친구의 MBTI와 특징을
27+
<br />
28+
입력해서 빠르게 대화할 수 있어요
2829
</p>
2930
</div>
3031
);

src/components/button/ToggleChatTipsButton.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ const ToggleChatTipsButton = ({
88
setIsOpen
99
}: ToggleChatTipsButtonProps) => {
1010
return (
11-
<img
12-
src={isOpen ? "/icon/close.svg" : "/icon/plus.svg"}
13-
onClick={() => setIsOpen(!isOpen)}
14-
alt="토글 메뉴 버튼"
15-
width={14}
16-
height={14}
17-
/>
11+
<button>
12+
<img
13+
src={isOpen ? "/icon/close.svg" : "/icon/plus.svg"}
14+
onClick={() => setIsOpen(!isOpen)}
15+
alt="토글 메뉴 버튼"
16+
width={14}
17+
height={14}
18+
/>
19+
</button>
1820
);
1921
};
2022

src/components/header/SubHeader.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ const SubHeader = ({
5656
src="/public/icon/arrow_left.svg"
5757
alt="Go To Back"
5858
className="absolute left-[18.77px] cursor-pointer"
59-
width={9.87}
59+
width={9}
6060
height={16}
6161
onClick={handleGoBack}
6262
/>
6363
)}
6464

65-
<h1 className="absolute left-1/2 -translate-x-1/2 transform text-[18px] font-bold text-gray-900">
65+
<h1 className="absolute left-1/2 -translate-x-1/2 transform font-bold text-gray-900">
6666
{title}
6767
</h1>
6868

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,41 @@
1+
import { Link } from "react-router-dom";
2+
13
const TipsMenu = ({
24
mode
35
}: {
46
mode: "topic" | "conversation" | "temporature";
57
}) => {
68
let text = "";
79
let imageUrl = "";
10+
let href = "";
11+
812
switch (mode) {
913
case "topic":
1014
text = "대화 주제 추천";
1115
imageUrl = "/icon/starbubble.svg";
16+
href = "/chat-recommend";
1217
break;
1318
case "conversation":
1419
text = "대화 꿀팁";
1520
imageUrl = "/icon/lightbulb.svg";
21+
href = "/chat-tips";
1622
break;
1723
case "temporature":
1824
text = "현재 대화의 온도 측정하기";
1925
imageUrl = "/icon/thermometer.svg";
26+
href = "/chat-temporature";
2027
break;
2128
default:
2229
return;
2330
}
2431

2532
return (
26-
<div className="flex bg-white px-4 py-4 border-gray-100 border-b w-[375px] h-[56px]">
27-
<img src={imageUrl} alt={text} width={20} height={20} />
28-
<h2 className="ml-[22px] font-medium text-2lg text-gray-800">{text}</h2>
29-
</div>
33+
<Link to={href}>
34+
<div className="flex h-[56px] w-full border-t border-gray-100 bg-white px-4 py-4 hover:bg-primary-pale">
35+
<img src={imageUrl} alt={text} width={20} height={20} />
36+
<h2 className="text-2lg ml-[22px] font-medium text-gray-800">{text}</h2>
37+
</div>
38+
</Link>
3039
);
3140
};
3241

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import TipsMenu from "@/components/tips/TipsMenu";
2+
3+
const TipsMenuContainer = () => {
4+
return (
5+
<>
6+
<TipsMenu mode="topic" />
7+
<TipsMenu mode="conversation" />
8+
<TipsMenu mode="temporature" />
9+
</>
10+
);
11+
};
12+
13+
export default TipsMenuContainer;

src/index.css

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,31 @@ body {
3030

3131
main {
3232
@media screen and (min-width: 360px) {
33+
font-size: 14px;
3334
width: 360px;
34-
3535
}
3636
@media screen and (min-width: 375px) {
37+
font-size: 16px;
3738
width: 375px;
38-
3939
}
4040
@media screen and (min-width: 500px) {
41+
font-size: 16px;
4142
width: 500px;
4243
}
4344
}
4445

46+
header {
47+
@media screen and (min-width: 360px) {
48+
font-size: 16px;
49+
}
50+
@media screen and (min-width: 375px) {
51+
font-size: 18px;
52+
}
53+
@media screen and (min-width: 500px) {
54+
font-size: 18px;
55+
}
56+
}
57+
4558
input:focus {
4659
outline: none;
4760
}
@@ -55,7 +68,6 @@ button:hover {
5568
}
5669

5770
@keyframes pulse-custom {
58-
5971
0%,
6072
100% {
6173
transform: scale(1);
@@ -87,4 +99,4 @@ button:hover {
8799
* {
88100
@apply transition-transform duration-200 ease-in-out;
89101
}
90-
}
102+
}

src/pages/Chat.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import ChatActionBar from "@/components/ChatActionBar";
66
import pickMbtiImage from "@/utils/pickMbtiImage";
77
import instance from "@/api/axios";
88
import { useLocation } from "react-router-dom";
9+
import { cls } from "@/utils/cls";
10+
import TipsMenuContainer from "@/components/tips/TipsMenuContainer";
911

1012
interface Message {
1113
role: "user" | "assistant";
@@ -27,7 +29,7 @@ const Chat = () => {
2729

2830
useEffect(() => {
2931
bottomRef.current?.scrollIntoView({ behavior: "smooth" });
30-
}, [messages]);
32+
}, [messages, isOpen]);
3133

3234
const chatTitle = `${mbti}와 대화`;
3335
const assistantInfo = mbti;
@@ -123,7 +125,6 @@ const Chat = () => {
123125

124126
<div ref={bottomRef} />
125127
</div>
126-
127128
<ChatActionBar
128129
isOpen={isOpen}
129130
setIsOpen={setIsOpen}
@@ -132,6 +133,7 @@ const Chat = () => {
132133
onKeyUp={handleKeyup}
133134
onSend={() => handleSend(input)}
134135
/>
136+
{isOpen && <TipsMenuContainer />}
135137
</div>
136138
);
137139
};

src/pages/Login.tsx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,45 @@ import useLayoutSize from "@/hooks/useLayoutSize";
77
const Login = () => {
88
const layoutSize = useLayoutSize();
99
const isPC = layoutSize === "lg";
10-
const [isModalOpen, setIsModalOpen] = useState<{isOpen : boolean, mode : "terms" | "privacy"}>({
10+
const [isModalOpen, setIsModalOpen] = useState<{
11+
isOpen: boolean;
12+
mode: "terms" | "privacy";
13+
}>({
1114
isOpen: false,
12-
mode: "terms",
15+
mode: "terms"
1316
});
1417

15-
const openModal =(mode : "terms" | "privacy")=> {
16-
setIsModalOpen({mode:mode, isOpen : true});
17-
}
18+
const openModal = (mode: "terms" | "privacy") => {
19+
setIsModalOpen({ mode: mode, isOpen: true });
20+
};
1821
const closeModal = () => {
19-
setIsModalOpen((state) => ({mode:state.mode, isOpen : false}));
20-
}
22+
setIsModalOpen((state) => ({ mode: state.mode, isOpen: false }));
23+
};
2124

2225
const isOpen = isModalOpen.isOpen;
2326
const isTerms = isModalOpen.mode === "terms";
2427

2528
return (
26-
<main className="bg-white flex flex-col items-center h-[812px]">
29+
<main className="flex h-[812px] flex-col items-center bg-white">
2730
<img
2831
src={isPC ? "/image/login/banner_lg.png" : "/image/login/banner.png"}
2932
alt="로그인 페이지 이미지"
30-
className="w-full h-[391px]"
33+
className="h-[391px] w-full"
3134
/>
32-
<h1 className="mt-12 font-bold text-3xl text-center whitespace-pre-wrap">
35+
<h1 className="mt-12 text-center text-3xl font-bold whitespace-pre-wrap">
3336
MBTI 성향 기반
3437
<br />
3538
AI 채팅 시뮬레이션으로
3639
<br />
3740
대화 연습과 꿀팁 얻어가세요
3841
</h1>
39-
<div className="mt-[39px] text-gray-900 text-xl">
42+
<div className="mt-[39px] text-xl text-gray-900">
4043
대화 연습부터, 피드백까지 드려요
4144
</div>
4245
<div className="mt-[47px]">
4346
<KakaoLoginButton />
4447
</div>
45-
<div className="w-full mt-auto mb-1">
48+
<div className="mt-auto w-full pb-4">
4649
<TermsAndPrivacy openModal={openModal} />
4750
</div>
4851
{isOpen ? (

src/pages/MbtiTestIntro.tsx

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import { ChangeEvent, FormEvent, useState } from "react";
22
import { useNavigate } from "react-router-dom";
33
import Header from "@/components/header/Header";
4+
import useLayoutSize from "@/hooks/useLayoutSize";
45
const MbtiTestIntro = () => {
56
const [name, setName] = useState("");
67
const navigate = useNavigate();
7-
8-
const handleChange = (e:ChangeEvent<HTMLInputElement>) => {
8+
const viewport = useLayoutSize();
9+
const bannerSize =
10+
viewport === "sm" ? "360" : viewport === "md" ? "375" : "500";
11+
const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
912
setName(e.target.value);
10-
}
13+
};
1114

1215
const handleSubmit = (e: FormEvent<HTMLFormElement>) => {
1316
e.preventDefault();
@@ -21,37 +24,48 @@ const MbtiTestIntro = () => {
2124

2225
localStorage.setItem("mbti-test-name", name);
2326
navigate("/mbti-test-progress");
24-
}
27+
};
2528

2629
return (
27-
<main className="sm:h-[812px] h-[1080px] flex flex-col">
28-
<Header title="상대방 MBTI 유추 테스트"/>
29-
<div className="relative flex-1 flex flex-col items-center w-full h-[756px]">
30-
<img src="/image/mbti-test/500px/intro_500.png" alt="intro image" className="inset-0 w-full h-full"/>
31-
<span className="absolute top-[38px] font-medium text-lg">그 사람의 mbti는 뭘까?</span>
32-
<h2 className="absolute top-[74px] font-extrabold text-[32px] text-center">
30+
<main className="flex h-[1080px] flex-col sm:h-[812px]">
31+
<Header title="상대방 MBTI 유추 테스트" />
32+
<div className="relative flex h-[756px] w-full flex-1 flex-col items-center">
33+
<img
34+
src={`/image/mbti-test/${bannerSize}px/intro_${bannerSize}.png`}
35+
alt="intro image"
36+
className="inset-0 h-full w-full"
37+
/>
38+
<span className="absolute top-[38px] text-lg font-medium">
39+
그 사람의 mbti는 뭘까?
40+
</span>
41+
<h2 className="absolute top-[74px] text-center text-[32px] leading-10 font-extrabold">
3342
<span className="text-[#2714FF]">상대방</span> MBTI
3443
<br />
3544
유추 테스트
3645
</h2>
37-
<form className="absolute top-[472px] flex flex-col items-center" onSubmit={handleSubmit}>
38-
<label htmlFor="name" className="font-medium text-lg ">MBTI를 알고 싶은 상대의 이름</label>
46+
<form
47+
className="absolute top-[472px] flex flex-col items-center"
48+
onSubmit={handleSubmit}
49+
>
50+
<label htmlFor="name" className="text-lg font-medium ">
51+
MBTI를 알고 싶은 상대의 이름
52+
</label>
3953
<input
4054
type="text"
4155
id="name"
4256
onChange={handleChange}
43-
className="bg-white border-gray-50 w-full rounded-lg mt-[30px] h-[68px] text-center"
57+
className="mt-[30px] h-[68px] w-full rounded-lg border-gray-50 bg-white text-center"
4458
/>
4559
<button
4660
type="submit"
47-
className="bg-primary-normal hover:opacity-80 mt-[60px] rounded-lg w-[320px] lg:w-[460px] h-[60px] font-bold text-white"
61+
className="mt-[60px] h-[60px] w-[320px] rounded-lg bg-primary-normal font-bold text-white hover:opacity-80 lg:w-[460px]"
4862
>
4963
시작하기
5064
</button>
51-
</form>
65+
</form>
5266
</div>
5367
</main>
54-
)
55-
}
68+
);
69+
};
5670

57-
export default MbtiTestIntro;
71+
export default MbtiTestIntro;

0 commit comments

Comments
 (0)