Skip to content

Commit 1ea1f4f

Browse files
authored
Merge pull request #154 from Umc8th-Snack/feat/article-responsive-sizing/#153
[Feat] ๊ธฐ์‚ฌํŽ˜์ด์ง€ ๋ฐ˜์‘ํ˜• ์ˆ˜์ •
2 parents 1cab62e + 2092069 commit 1ea1f4f

22 files changed

Lines changed: 155 additions & 66 deletions

โ€Žsrc/index.cssโ€Ž

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
--text-36px-semibold: 36px;
4040
--text-36px-semibold--font-weight: 600;
4141

42+
--text-32px-semibold: 32px;
43+
--text-32px-semibold--font-weight: 600;
44+
4245
--text-28px-semibold: 28px;
4346
--text-28px-semibold--font-weight: 600;
4447

@@ -51,6 +54,9 @@
5154
--text-18px-semibold: 18px;
5255
--text-18px-semibold--font-weight: 600;
5356

57+
--text-16px-semibold: 16px;
58+
--text-16px-semibold--font-weight: 600;
59+
5460
/* medium */
5561
--text-36px-medium: 36px;
5662
--text-36px-medium--font-weight: 500;

โ€Žsrc/layout/ArticleLayout.tsxโ€Ž

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ interface ArticleLayoutProps {
1010
const ArticleLayout = ({ children, sidebarContent }: ArticleLayoutProps) => {
1111
return (
1212
<div className="px-6 py-6">
13-
<div className="mx-auto grid max-w-[1100px] grid-cols-[720px_264px] gap-30">
13+
<div className="mx-auto grid max-w-[1100px] grid-cols-[100%] lg:grid-cols-[70%_30%]">
1414
<div>
15-
<div className="flex flex-col gap-4 px-6 py-6">{children}</div>
15+
<div className="flex flex-col gap-4 pb-4 lg:px-6 lg:py-6">{children}</div>
1616
</div>
1717

1818
{/* Sidebar */}
1919
<aside className="mt-8">
20-
<div className="sticky top-15">
21-
{sidebarContent || <RelatedArticleList onClose={() => {}} articleId={0} />}
20+
<div className="sticky top-15 flex lg:justify-end">
21+
<div className="w-full lg:w-auto">
22+
{sidebarContent || <RelatedArticleList onClose={() => {}} articleId={0} />}
23+
</div>
2224
</div>
2325
</aside>
2426
</div>

โ€Žsrc/layout/MainLayout.tsxโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Outlet } from 'react-router-dom';
22

3-
import Navbar from '@/shared/components/Navbar/Navbar';
3+
import Navbar from '@/shared/components/navbar/Navbar';
44

55
const MainLayout = () => {
66
return (

โ€Žsrc/pages/article/ArticlePage.tsxโ€Ž

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import RelatedArticleList from '@/pages/article/components/RelatedArticleList/Re
99
import SummarizedNewsContainer from '@/pages/article/components/SummarizedNewsContainer/SummarizedNewsContainer';
1010
import type { ArticleDetail } from '@/pages/article/types/article';
1111
import LoadingFallback from '@/routes/LoadingFallback';
12+
import FloatingMemoButton from '@/shared/components/button/FloatingMemoButton';
1213
import MemoPad from '@/shared/components/modal/MemoPad/MemoPad';
1314

1415
const ArticlePage = () => {
@@ -83,19 +84,25 @@ const ArticlePage = () => {
8384
/>
8485
</div>
8586
)}
86-
<div className="pt-8">
87+
<div className="pt-4">
8788
<AccordionTestPage articleId={articleId} />
8889
</div>
8990
</ArticleLayout>
9091

9192
{/* ๋ฉ”๋ชจ์žฅ ์˜ค๋ฒ„๋ ˆ์ด */}
9293
{isMemoPadOpen && articleId && (
93-
<div className="fixed top-0 right-0 z-50 px-18 py-18">
94-
<div className="mt-20">
94+
<div
95+
className="fixed inset-0 z-50 flex items-center justify-center bg-black/20 md:top-0 md:right-0 md:items-start md:justify-end md:bg-transparent md:p-4 md:px-18 md:py-18"
96+
onClick={() => setIsMemoPadOpen(false)}
97+
>
98+
<div className="sm:mt-20" onClick={(e) => e.stopPropagation()}>
9599
<MemoPad articleId={articleId} />
96100
</div>
97101
</div>
98102
)}
103+
104+
{/* Floating ๋ฉ”๋ชจ์žฅ ๋ฒ„ํŠผ (lg ๋ฏธ๋งŒ์—์„œ๋งŒ ํ‘œ์‹œ) */}
105+
<FloatingMemoButton onClick={() => setIsMemoPadOpen(!isMemoPadOpen)} isActive={isMemoPadOpen} />
99106
</>
100107
);
101108
};

โ€Žsrc/pages/article/QuizCommentaryPage.tsxโ€Ž

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import QuizCommentary from '@/pages/article/components/Quiz/QuizCommentary';
99
import RelatedArticleList from '@/pages/article/components/RelatedArticleList/RelatedArticleList';
1010
import { useQuizCommentary } from '@/pages/article/hooks/useQuizCommentary';
1111
import LoadingFallback from '@/routes/LoadingFallback';
12+
import FloatingMemoButton from '@/shared/components/button/FloatingMemoButton';
1213
import MemoPad from '@/shared/components/modal/MemoPad/MemoPad';
1314

1415
const QuizCommentaryPage = () => {
@@ -80,12 +81,18 @@ const QuizCommentaryPage = () => {
8081

8182
{/* ๋ฉ”๋ชจ์žฅ ์˜ค๋ฒ„๋ ˆ์ด */}
8283
{isMemoPadOpen && articleId && (
83-
<div className="fixed top-0 right-0 z-50 px-18 py-8">
84-
<div className="mt-20">
84+
<div
85+
className="fixed inset-0 z-50 flex items-center justify-center bg-black/20 md:top-0 md:right-0 md:items-start md:justify-end md:bg-transparent md:p-4 md:px-18 md:py-18"
86+
onClick={() => setIsMemoPadOpen(false)}
87+
>
88+
<div className="sm:mt-20" onClick={(e) => e.stopPropagation()}>
8589
<MemoPad articleId={articleId} />
8690
</div>
8791
</div>
8892
)}
93+
94+
{/* Floating ๋ฉ”๋ชจ์žฅ ๋ฒ„ํŠผ (lg ๋ฏธ๋งŒ์—์„œ๋งŒ ํ‘œ์‹œ) */}
95+
<FloatingMemoButton onClick={() => setIsMemoPadOpen(!isMemoPadOpen)} isActive={isMemoPadOpen} />
8996
</>
9097
);
9198
};

โ€Žsrc/pages/article/components/Accordion/Accordion.tsxโ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ const Accordion = ({
2626
<div className="mb-4">
2727
<div className="flex items-center justify-between">
2828
<div className="flex items-center space-x-2">
29-
<SnackIcon />
30-
<h3 className="text-24px-semibold">{title}</h3>
29+
<SnackIcon className="h-7 w-7 md:h-9 md:w-9" />
30+
<h3 className="text-20px-semibold md:text-24px-semibold">{title}</h3>
3131
</div>
3232
{onReport && (
3333
<button type="button" onClick={onReport} className="rounded-[8px] p-1 hover:bg-black/5">
3434
<ReportIcon className="text-black-70 h-[24px] w-[24px] cursor-pointer" />
3535
</button>
3636
)}
3737
</div>
38-
<p className="text-14px-medium text-black-50 mt-1">
38+
<p className="text-14px-medium md:text-16px-medium text-black-50 mt-1">
3939
{isQuiz ? '๊ธฐ์‚ฌ๋ฅผ ๋‹ค ์ฝ์œผ์…จ๊ตฐ์š”! ํ€ด์ฆˆ๋ฅผ ํ’€๋Ÿฌ ๊ฐ€๋ณผ๊นŒ์š”?' : '์ด ๊ธฐ์‚ฌ์˜ ํ•ต์‹ฌ ์–ดํœ˜๋“ค์„ ์‚ดํŽด๋ณด์•„์š”.'}
4040
</p>
4141
</div>

โ€Žsrc/pages/article/components/ArticleHeader.tsxโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function ArticleHeader({
2929
href={originalLink}
3030
target="_blank"
3131
rel="noopener noreferrer"
32-
className="text-20px-medium text-black-70 decoration-black-70 inline-block max-w-[525px] truncate align-bottom underline decoration-[0.5px] underline-offset-5"
32+
className="text-18px-medium md:text-20px-medium text-black-70 decoration-black-70 inline-block max-w-[525px] truncate align-bottom underline decoration-[0.5px] underline-offset-5"
3333
title={originalLink}
3434
>
3535
์›๋ฌธ๋งํฌ

โ€Žsrc/pages/article/components/GlossaryQuiz.tsxโ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ const GlossaryQuiz = ({ articleId }: GlossaryQuizProps) => {
6868
console.log('========================');
6969

7070
return (
71-
<div className="min-h-screen">
71+
<div className="lg:min-h-screen">
7272
<div className="mx-auto max-w-4xl">
73-
<div className="grid grid-cols-2 gap-8">
73+
<div className="grid grid-cols-1 gap-8 md:grid-cols-2">
7474
<div className="space-y-4">
7575
<Accordion
7676
title="์šฉ์–ด์ง‘"

โ€Žsrc/pages/article/components/Quiz/QuizCommentary.tsxโ€Ž

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import QuizHeader from '@/pages/article/components/Quiz/QuizHeader';
22
import QuizQuestionItem from '@/pages/article/components/Quiz/QuizQuestionItem';
33
import QuizResultMessage from '@/pages/article/components/Quiz/QuizResultMessage';
4-
import { SCROLL_CONFIG } from '@/pages/article/constants/quiz';
54
import { useQuizScroll } from '@/pages/article/hooks/useQuizScroll';
65

76
interface Question {
@@ -24,17 +23,17 @@ function QuizCommentary({ questions, totalQuestions, correctAnswers }: QuizComme
2423
});
2524

2625
return (
27-
<div className="border-main-30 w-full rounded-[30px] border-[3px] bg-white p-8 shadow-sm">
26+
<div className="border-main-30 w-full rounded-[20px] border-[3px] bg-white px-4 pt-4 pb-4 md:px-6 md:pt-6 md:pb-6 lg:px-[30px] lg:pt-[30px] lg:pb-[28px]">
2827
<QuizHeader />
2928

3029
{/* ์Šคํฌ๋กค ๊ฐ€๋Šฅํ•œ ์ฝ˜ํ…์ธ  ์˜์—ญ */}
31-
<div ref={scrollRef} className={`${SCROLL_CONFIG.MAX_HEIGHT} overflow-y-auto p-2`}>
30+
<div ref={scrollRef} className="p-2 lg:max-h-140 lg:overflow-y-auto">
3231
{/* ๋ฌธ์ œ๋ณ„ ํ•ด์„ค */}
3332
{questions.map((question) => (
3433
<QuizQuestionItem key={question.id} question={question} />
3534
))}
3635

37-
{/* ๊ฒฐ๊ณผ ๋ฉ”์‹œ์ง€ (์Šคํฌ๋กค ์‹œ ๋‚˜ํƒ€๋‚จ) */}
36+
{/* ๊ฒฐ๊ณผ ๋ฉ”์‹œ์ง€ (lg ๋ฏธ๋งŒ์—์„œ๋Š” ์ฆ‰์‹œ ํ‘œ์‹œ, lg ์ด์ƒ์—์„œ๋Š” ์Šคํฌ๋กค ์‹œ ํ‘œ์‹œ) */}
3837
<QuizResultMessage
3938
totalQuestions={totalQuestions}
4039
correctAnswers={correctAnswers}

โ€Žsrc/pages/article/components/Quiz/QuizHeader.tsxโ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import RectangleIcon from '@/shared/assets/Rectangle105.svg?react';
55
const QuizHeader = () => {
66
return (
77
<>
8-
<div className="flex items-center justify-between pb-6">
8+
<div className="flex items-center justify-between pb-4 lg:pb-6">
99
<div className="flex items-center gap-2">
10-
<RectangleIcon />
11-
<h1 className="text-28px-semibold">ํ•ด์„ค</h1>
10+
<RectangleIcon className="h-5 w-5 md:h-7 md:w-7" />
11+
<h1 className="text-20px-semibold md:text-28px-semibold relative">ํ•ด์„ค</h1>
1212
</div>
1313
</div>
1414
<div className="border-black-30 mb-4 border-t" />

0 commit comments

Comments
ย (0)