Skip to content

Commit f9d9421

Browse files
authored
Merge pull request #112 from Devminjeong-eum/feat/DEV-175
[DEV-175] 퀴즈 결과 페이지 공유 기능 툴팁 UI 추가
2 parents fb39d9b + eb69b16 commit f9d9421

File tree

9 files changed

+127
-22
lines changed

9 files changed

+127
-22
lines changed

public/sw.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/word/search/page.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import Search from '@/components/pages/search';
44

55
// eslint-disable-next-line react-refresh/only-export-components
66
export async function generateMetadata(
7-
{
8-
searchParams,
9-
}: { searchParams: { keyword: string } },
7+
{ searchParams }: { searchParams: { keyword: string } },
108
parent: ResolvingMetadata,
119
) {
1210
const parentMetadata = (await parent) || [];
@@ -47,11 +45,11 @@ export default async function SearchPage({ searchParams }: Props) {
4745
const word = decodeURI(searchParams.keyword);
4846

4947
return (
50-
<>
48+
<div className="h-full bg-[#FBFCFE]">
5149
<Header />
5250
<main className="rounded-[24px] bg-[#FBFCFE] -mt-[20px] z-50 flex flex-col gap-[8px]">
5351
<Search word={word} />
5452
</main>
55-
</>
53+
</div>
5654
);
5755
}

src/components/layout/Header.tsx

+11-11
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ export default function Header() {
3131
return (
3232
<>
3333
<div className="bg-main-gradient-top h-[48px] flex items-center p-6 justify-between border-none">
34-
<div className="flex-1">
35-
<Link href={WORD_LIST_PATH}>
36-
<LogoTextSvg />
34+
<Link href={WORD_LIST_PATH}>
35+
<LogoTextSvg />
36+
</Link>
37+
<div className="flex gap-[14px]">
38+
<Link href={QUIZ_PATH}>
39+
<QuizButton />
40+
</Link>
41+
<Link href={PROFILE_PATH}>
42+
<div className="pt-[2px]">
43+
<MypageIconSvg />
44+
</div>
3745
</Link>
3846
</div>
39-
<Link href={QUIZ_PATH}>
40-
<QuizButton />
41-
</Link>
42-
<Link href={PROFILE_PATH}>
43-
<div className="text-[#A8B8FF]">
44-
<MypageIconSvg />
45-
</div>
46-
</Link>
4747
</div>
4848
<SearchBar />
4949
{!isScrolled && <DynamicToolTip isOpen={isOpen} setIsOpen={setIsOpen} />}

src/components/layout/SearchBar.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ export default function SearchBar() {
157157
<div
158158
className={clsx(
159159
'relative rounded-[16px] z-[60]',
160-
isDropdownOpen && 'bg-white ring-[1px] ring-[#4357DB] drop-shadow',
160+
isDropdownOpen &&
161+
'bg-white ring-[1px] ring-[#4357DB] drop-shadow overflow-hidden',
161162
)}
162163
ref={searchBarRef}
163164
>

src/components/pages/home/QuizButton.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export default function QuizButton() {
22
return (
33
<>
4-
<button className="relative text-white w-[57px] h-[28px] bg-[#354BD2] ring-1 ring-[#5368EB] flex items-center justify-center rounded-[8px] mr-[14px]">
4+
<button className="relative text-white w-[57px] h-[28px] bg-[#354BD2] ring-1 ring-[#5368EB] flex items-center justify-center rounded-[8px]">
55
<svg
66
width="34"
77
height="13"

src/components/pages/quiz/QuizResult.tsx

+17-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ import {
1212
import { useRouter } from 'next/navigation';
1313
import ShareButtonSvg from '@/components/svg-component/ShareButtonSvg.tsx';
1414
import useAuthQuery from '@/hooks/query/useAuthQuery.ts';
15-
import { useState } from 'react';
15+
import { useEffect, useState } from 'react';
1616
import LoginAlertModal from '@/components/common/LoginAlertModal.tsx';
1717
import Link from 'next/link';
18+
import QuizShareTooltip from './QuizShareTooltip';
19+
import useScroll from '@/hooks/useScroll';
1820

1921
type Props = {
2022
quizResultId: string;
@@ -36,6 +38,17 @@ export default function QuizResult({
3638
const [isOpenModal, setIsOpenModal] = useState(false);
3739
const isLoggedIn = !data?.error ?? false;
3840
const isGuest = quizResultId === 'guest';
41+
const isScrolled = useScroll();
42+
const [isOpen, setIsOpen] = useState(
43+
() =>
44+
typeof window !== 'undefined' &&
45+
sessionStorage.getItem('isQuizShareOpen') !== 'false',
46+
);
47+
48+
useEffect(() => {
49+
if (sessionStorage.getItem('isQuizShareOpen')) setIsOpen(false);
50+
if (!isOpen) sessionStorage.setItem('isQuizShareOpen', 'false');
51+
}, [isOpen]);
3952

4053
const handleNeedLogin = () => {
4154
setIsOpenModal(true);
@@ -87,6 +100,9 @@ export default function QuizResult({
87100
</button>
88101
</Link>
89102
<LoginAlertModal isOpen={isOpenModal} />
103+
{!isScrolled && (
104+
<QuizShareTooltip isOpen={isOpen} setIsOpen={setIsOpen} />
105+
)}
90106
</div>
91107
);
92108
}

0 commit comments

Comments
 (0)