Skip to content

Commit cde55d2

Browse files
authored
Merge pull request #100 from Devminjeong-eum/fix/DEV-156
[DEV-156] 트렌딩 단어 페이지에서 순위 아이템 클릭시 바로 디테일 페이지로 이동되도록 수정
2 parents 28ffe11 + 1eca0ef commit cde55d2

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

src/components/pages/home/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const HomeClientPage = () => {
2222
);
2323

2424
return (
25-
<main className="py-5 rounded-[24px] bg-[#FBFCFE] -mt-[20px] z-50 flex flex-col gap-[8px]">
25+
<main className="py-5 rounded-[24px] bg-[#FBFCFE] min-h-screen -mt-[20px] z-50 flex flex-col gap-[8px]">
2626
<div className="px-5">
2727
<HomeToggleZone handleToggle={handleToggle} isTrending={isTrending} />
2828
</div>

src/components/pages/home/trending-posts/GeneralRanking.tsx

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
import { TrendWord } from '@/fetcher/types';
22
import clsx from 'clsx';
33
import { RankChange } from './RankChange';
4+
import { getWordDetailPath } from '@/routes/path';
5+
import Link from 'next/link';
46

57
type Props = {
68
generalRankingList: TrendWord[];
79
};
810

911
export default function GeneralRanking({ generalRankingList }: Props) {
1012
return (
11-
<div className="w-full mt-[22px] border-[#F2F4F9] border-[1px] rounded-2xl py-[22px]">
13+
<div className="w-full mt-[22px] border-[#F2F4F9] border-[1px] rounded-2xl py-[8px] ">
1214
{generalRankingList.map((trendWord, index) => (
1315
<div
14-
key={index}
16+
key={trendWord.id}
1517
className={clsx(
16-
'h-[54px] border-[#ECEEF5] border-b-[1px] w-full flex items-center',
18+
'h-[54px] border-[#ECEEF5] border-b-[1px] w-full flex items-center ',
1719
index === 0 && '-mt-[6px]',
1820
index === 6 && 'border-none',
1921
)}
@@ -24,13 +26,17 @@ export default function GeneralRanking({ generalRankingList }: Props) {
2426
</p>
2527

2628
{/* 영단어 컨테이너 */}
27-
<span className="flex ml-[29px] gap-[6px] flex-1 items-end ">
28-
<p className="text-[16px] text-main-black">{trendWord.name}</p>
29-
<span className="text-[#F2F4F9]">|</span>
30-
<p className="text-[#6F6F80] text-[14px]">
29+
<Link
30+
href={getWordDetailPath(trendWord.name)}
31+
className="flex ml-[29px] gap-[6px] flex-1 items-center group"
32+
>
33+
<p className="text-[16px] leading-[17px] font-medium text-main-black group-hover:underline underline-offset-2">
34+
{trendWord.name}
35+
</p>
36+
<p className="text-[#6F6F80] text-[14px] font-medium">
3137
{trendWord.pronunciation}
3238
</p>
33-
</span>
39+
</Link>
3440

3541
{/* 순위 등락 컨테이너 */}
3642
<RankChange

src/components/pages/home/trending-posts/TopRanking.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import type { TrendWord } from '@/fetcher/types';
55
import clsx from 'clsx';
66
import { useEffect, useState } from 'react';
77
import { RankChange } from './RankChange';
8+
import { useRouter } from 'next/navigation';
9+
import { getWordDetailPath } from '@/routes/path';
810

911
const TopRankingItem = ({
1012
trendWord,
@@ -15,19 +17,23 @@ const TopRankingItem = ({
1517
index: number;
1618
isMount: boolean;
1719
}) => {
20+
const router = useRouter();
21+
const { rank, rankChange, name, pronunciation, diacritic } = trendWord;
1822
const gradientStyles = [
1923
'bg-rank-gradient-one duration-700 w-[340px] xs:w-[390px]',
2024
'bg-rank-gradient-two duration-1000 w-[316px] xs:w-[366px]',
2125
'bg-rank-gradient-three h-[67px] duration-[1300ms] w-[292px] xs:w-[342px]',
2226
];
2327

24-
const { rank, rankChange, name, pronunciation, diacritic } = trendWord;
28+
const moveToDetailPage = () => {
29+
router.push(getWordDetailPath(name));
30+
};
2531

2632
return (
2733
<div
28-
key={`item_${index}`}
34+
onClick={moveToDetailPage}
2935
className={clsx(
30-
'h-[72px] rounded-r-[100px] flex items-center pl-[34px] transition-transform',
36+
'h-[72px] rounded-r-[100px] flex items-center pl-[34px] transition-transform cursor-pointer',
3137
index !== 0 && 'mt-[4px]',
3238
gradientStyles[index],
3339
isMount ? 'translate-x-0' : '-translate-x-full',

0 commit comments

Comments
 (0)