Skip to content

Commit d70639f

Browse files
committed
hotfix : 문제풀이 디자인 수정
1 parent 62699ae commit d70639f

File tree

9 files changed

+75
-54
lines changed

9 files changed

+75
-54
lines changed

src/app/(auth)/(navigationsBarLayout)/problems/[problemId]/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default async function ProblemPageLayout({
1717
<TabsToggle problemId={problemId} />
1818
{tabs}
1919
</menu>
20-
<div className="w-[1px] h-full bg-border_primary" />
20+
<div className="w-[1px] h-full border border-gray-800" />
2121
<div className="flex-1 w-full h-full">{children}</div>
2222
</main>
2323
);

src/app/(auth)/(navigationsBarLayout)/problems/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import ProblemTable from './ui/Table';
66
import { useProblemListQuery } from '@/entities/problems/model/query';
77
import { Select } from '@/shared/ui/select/Select';
88
import { Button } from '@/shared/ui/button/Button';
9+
import { LevelUtil } from '@/shared/util/levelUtil';
910

1011
const categoryCodeOptions = [
1112
{ label: '출력', value: 'OUTPUT' },
@@ -200,7 +201,7 @@ const ProblemsList = () => {
200201
)}
201202
{difficulty !== '전체' && difficulty && (
202203
<div
203-
className={`flex flex-row gap-2 items-center px-3 py-1.5 rounded-full text-sm font-medium transition-all duration-200`}
204+
className={`flex flex-row gap-2 items-center px-3 py-1.5 rounded-full text-sm font-medium transition-all duration-200 border ${LevelUtil.getLevelBg(difficulty)} ${LevelUtil.getLevelColorClass(difficulty)}`}
204205
>
205206
<span>{difficultyOptions.find((item) => item.value === difficulty)?.label}</span>
206207
<Image

src/app/(auth)/(navigationsBarLayout)/problems/ui/Table.tsx

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,10 @@ import { useMyDailySolved } from '@/entities/mypage/model/query';
77
import { CheckCircle, ChevronLeft, ChevronRight } from 'lucide-react';
88
import { Button } from '@/components/ui/button';
99
import Cookies from 'js-cookie';
10+
import { LevelUtil } from '@/shared/util/levelUtil';
1011

1112
const PAGE_LIMIT = 15;
1213

13-
const getLevelColorClass = (levelStr: string): string => {
14-
if (!levelStr) return '';
15-
const level = parseInt(levelStr.replace(/[^0-9]/g, ''), 10);
16-
if (level <= 2) return 'text-blue-400 font-medium';
17-
if (level <= 4) return 'text-yellow-400 font-medium';
18-
if (level <= 6) return 'text-orange-400 font-medium';
19-
return 'text-red-400 font-medium';
20-
};
21-
22-
const getLevelBg = (difficulty: string) => {
23-
const level = parseInt(difficulty.replace(/[^0-9]/g, ''), 10);
24-
if (level <= 2) return 'bg-blue-500/20 border-blue-500/30';
25-
if (level <= 4) return 'bg-yellow-500/20 border-yellow-500/30';
26-
if (level <= 6) return 'bg-orange-500/20 border-orange-500/30';
27-
return 'bg-red-500/20 border-red-500/30';
28-
};
29-
30-
const getLevelText = (difficulty: string) => {
31-
const level = parseInt(difficulty.replace(/[^0-9]/g, ''), 10);
32-
const labels = {
33-
1: '입문',
34-
2: '초급',
35-
3: '중급',
36-
4: '중상급',
37-
5: '고급',
38-
6: '전문가',
39-
7: '마스터',
40-
};
41-
return `${labels[level as keyof typeof labels] || '알 수 없음'} (${level}단계)`;
42-
};
43-
4414
export default function ProblemTable({
4515
data,
4616
isLoading,
@@ -179,11 +149,11 @@ export default function ProblemTable({
179149
</td>
180150
<td className={`px-6 py-4 text-center text-sm font-medium`}>
181151
<span
182-
className={`inline-flex items-center px-3 py-1.5 text-xs font-medium rounded-full border transition-all duration-200 hover:scale-105 ${getLevelBg(
152+
className={`inline-flex items-center px-3 py-1.5 text-xs font-medium rounded-full border transition-all duration-200 hover:scale-105 ${LevelUtil.getLevelBg(
183153
item.difficulty
184-
)} ${getLevelColorClass(item.difficulty)}`}
154+
)} ${LevelUtil.getLevelColorClass(item.difficulty)}`}
185155
>
186-
{getLevelText(item.difficulty)}
156+
{LevelUtil.getLevelText(item.difficulty)}
187157
</span>
188158
</td>
189159
<td className="px-6 py-4 text-center text-sm text-gray-300 ">

src/entities/problem/ui/DetailProblem.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { IDetailProblemResponse } from '../api/server/getDetailProblem.type';
44
import Arrow from '@/shared/ui/icons/arrow-icon';
55
import Image from 'next/image';
66
import MarkdownRenderer from '@/shared/mdx/MdxRenderer';
7+
import { LevelUtil } from '@/shared/util/levelUtil';
78

89
interface IDetailProblemProps {
910
detailProblem: IDetailProblemResponse;
@@ -31,7 +32,13 @@ export default function DetailProblem({ detailProblem }: IDetailProblemProps) {
3132
<div className="flex gap-4 items-center">
3233
<span className="text-gray-400">배점 : {score}</span>
3334
<div className="flex gap-2 items-center">
34-
<span className="text-[#FFCFA7]">{difficulty}</span>
35+
<span
36+
className={`inline-flex items-center px-3 py-1.5 text-xs font-medium rounded-full border transition-all duration-200 ${LevelUtil.getLevelBg(
37+
difficulty
38+
)} ${LevelUtil.getLevelColorClass(difficulty)}`}
39+
>
40+
{LevelUtil.getLevelText(difficulty)}
41+
</span>
3542
{categories && categories.length > 0 && (
3643
<>
3744
<Arrow direction="right" className="text-white" />

src/features/discussions/DiscussionFooter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default function DiscussionFooter({ ...props }: IDiscussionFooterProps) {
2121
const { problemId, replyCount, id, content, type, onDelete, onEdit, setChildRepliesOpen } = props;
2222

2323
return (
24-
<div className="flex items-center gap-2">
24+
<div className="flex items-center gap-3">
2525
<Vote problemId={problemId} content={content} id={id} type={type} />
2626
{replyCount !== undefined && (
2727
<ShowChildReplies onClick={() => setChildRepliesOpen?.()} replyCount={replyCount} />

src/features/discussions/disussions/ui/Discussions.tsx

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,29 @@ export default function Discussions({ problemId }: IDiscussionProps) {
9494
}}
9595
/> */}
9696
<div className="flex flex-row gap-1">
97-
{sortOptions.map((item) => {
98-
return (
99-
<span
100-
key={item.value}
101-
className={`${item.value === params.sort ? `text-secondary` : ``}`}
102-
onClick={() => {
103-
setParams((prev) => ({ ...prev, sort: item.label, sortBy: item.label }));
104-
}}
105-
>
106-
{item.label}
107-
</span>
108-
);
109-
})}
97+
<div className="flex flex-row gap-1 mb-4 bg-secondary-background rounded-[10px] p-1">
98+
{sortOptions.map((item) => {
99+
const isActive = item.value === params.sort;
100+
return (
101+
<button
102+
key={item.value}
103+
className={`
104+
flex-1 py-3 px-6 rounded-[10px] font-medium transition-all duration-200
105+
${
106+
isActive
107+
? 'bg-[#214d35] text-white shadow-lg'
108+
: 'text-white hover:bg-[rgba(255,255,255,0.08)] hover:text-secondary'
109+
}
110+
`}
111+
onClick={() => {
112+
setParams((prev) => ({ ...prev, sort: item.label, sortBy: item.label }));
113+
}}
114+
>
115+
{item.label}
116+
</button>
117+
);
118+
})}
119+
</div>
110120
</div>
111121
{discussions.length < 1 ? (
112122
<div className="flex justify-center text-[#ccc] mt-3">

src/features/discussions/vote/ui/Vote.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default function Vote({ content, problemId, id, type }: IVoteProps) {
5454
changeVoteStatus('UP');
5555
}}
5656
/>
57-
{voteCount.upvoteCount}
57+
<p className="pt-[4px]">{voteCount.upvoteCount}</p>
5858
</div>
5959
<div className="flex items-center gap-1">
6060
<DownVoteIcon
@@ -63,7 +63,7 @@ export default function Vote({ content, problemId, id, type }: IVoteProps) {
6363
changeVoteStatus('DOWN');
6464
}}
6565
/>
66-
{voteCount.downvoteCount}
66+
<p className="pt-[4px]">{voteCount.downvoteCount}</p>
6767
</div>
6868
</>
6969
);

src/shared/ui/InputFiled/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ export default function UnifiedInput({ inputType, label, ...props }: Props) {
3131
case 'input':
3232
return <InputTypeFiled name={name} {...rest} />;
3333
case 'textarea':
34-
return <TextAreaTypeFiled name={name} {...rest} />;
34+
return (
35+
<TextAreaTypeFiled className="border-gray-800 border shadow-lg" name={name} {...rest} />
36+
);
3537
case 'image':
3638
return <ImageTypeFiled name={name} imageProps={imageProps} className={rest.className} />;
3739
default:

src/shared/util/levelUtil.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/** 유틸 함수 */
2+
export class LevelUtil {
3+
static getLevelColorClass(levelStr: string): string {
4+
if (!levelStr) return '';
5+
const level = parseInt(levelStr.replace(/[^0-9]/g, ''), 10);
6+
if (level <= 2) return 'text-blue-400 font-medium';
7+
if (level <= 4) return 'text-yellow-400 font-medium';
8+
if (level <= 6) return 'text-orange-400 font-medium';
9+
return 'text-red-400 font-medium';
10+
}
11+
static getLevelBg(difficulty: string): string {
12+
const level = parseInt(difficulty.replace(/[^0-9]/g, ''), 10);
13+
if (level <= 2) return 'bg-blue-500/20 border-blue-500/30';
14+
if (level <= 4) return 'bg-yellow-500/20 border-yellow-500/30';
15+
if (level <= 6) return 'bg-orange-500/20 border-orange-500/30';
16+
return 'bg-red-500/20 border-red-500/30';
17+
}
18+
static getLevelText(difficulty: string): string {
19+
const level = parseInt(difficulty.replace(/[^0-9]/g, ''), 10);
20+
const labels = {
21+
1: '입문',
22+
2: '초급',
23+
3: '중급',
24+
4: '중상급',
25+
5: '고급',
26+
6: '전문가',
27+
7: '마스터',
28+
};
29+
return `${labels[level as keyof typeof labels] || '알 수 없음'} (${level}단계)`;
30+
}
31+
}

0 commit comments

Comments
 (0)