Skip to content

Commit

Permalink
Revert "fix : 라우터 기능 추가"
Browse files Browse the repository at this point in the history
This reverts commit f473d31.
  • Loading branch information
jaeyo03 committed Feb 7, 2025
1 parent f473d31 commit 9127b36
Showing 1 changed file with 49 additions and 66 deletions.
115 changes: 49 additions & 66 deletions src/pages/SearchPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,82 +158,64 @@ const SearchPage = () => {
setLayout(layouticon);
};

const handleCardClick = contentId => {
navigate(`/detail/${contentId}`); // 상세 페이지로 이동
window.scrollTo(0, 0);
};

const renderCard = item => {
switch (layout) {
case 'large-layout':
return (
<button
className="w-full"
onClick={() => {
const contentId = item.contentsid;
window.location.href = `/detail/${contentId}`;
}}
key={item.contentsid}
>
<DetailCard
key={item.id}
title={item.title || '제목이 없습니다'}
city={item.region1cd?.label || '도시'}
street={
item.region2cd?.label == 'region>' || item.region2cd?.label == undefined
? '제주시내'
: item.region2cd?.label
}
description={item.introduction || '설명이 없습니다.'}
img={item.repPhoto?.photoid?.thumbnailpath || '/images/no_image.svg'}
contentid={item?.contentsid}
/>
</button>
<DetailCard
key={item.id}
onClick={() => handleCardClick(item.contentsid)}
title={item.title || '제목이 없습니다'}
city={item.region1cd?.label || '도시'}
street={
item.region2cd?.label == 'region>' || item.region2cd?.label == undefined
? '제주시내'
: item.region2cd?.label
}
description={item.introduction || '설명이 없습니다.'}
img={item.repPhoto?.photoid?.thumbnailpath || '/images/no_image.svg'}
contentid={item}
/>
);
case 'medium-layout':
return (
<button
className=" mr-10 [&:nth-child(3n)]:mr-0"
onClick={() => {
const contentId = item.contentsid;
window.location.href = `/detail/${contentId}`;
}}
key={item.contentsid}
>
<DetailMediumCard
key={item.id}
title={item.title || '제목이 없습니다'}
city={item.region1cd?.label || '도시'}
street={
item.region2cd?.label == 'region>' || item.region2cd?.label == undefined
? '제주시내'
: item.region2cd?.label
}
img={item.repPhoto?.photoid?.thumbnailpath || '/images/no_image.svg'}
category={item.contentscd?.value}
contentid={item?.contentsid}
/>
</button>
<DetailMediumCard
key={item.id}
onClick={() => handleCardClick(item.contentsid)}
title={item.title || '제목이 없습니다'}
city={item.region1cd?.label || '도시'}
street={
item.region2cd?.label == 'region>' || item.region2cd?.label == undefined
? '제주시내'
: item.region2cd?.label
}
img={item.repPhoto?.photoid?.thumbnailpath || '/images/no_image.svg'}
category={item.contentscd?.value}
contentid={item}
/>
);
case 'small-layout':
return (
<button
onClick={() => {
const contentId = item.contentsid;
window.location.href = `/detail/${contentId}`;
}}
key={item.contentsid || ''}
>
<DetailSmallCard
key={item.id}
title={item.title || '제목이 없습니다'}
city={item.region1cd?.label || '도시'}
street={
item.region2cd?.label == 'region>' || item.region2cd?.label == undefined
? '제주시내'
: item.region2cd?.label
}
description={item.introduction || '설명이 없습니다.'}
img={item.repPhoto?.photoid?.thumbnailpath || '/images/no_image.svg'}
category={item.contentscd?.value}
contentid={item?.contentsid}
/>
</button>
<DetailSmallCard
key={item.id}
onClick={() => handleCardClick(item.contentsid)}
title={item.title || '제목이 없습니다'}
city={item.region1cd?.label || '도시'}
street={
item.region2cd?.label == 'region>' || item.region2cd?.label == undefined
? '제주시내'
: item.region2cd?.label
}
description={item.introduction || '설명이 없습니다.'}
img={item.repPhoto?.photoid?.thumbnailpath || '/images/no_image.svg'}
category={item.contentscd?.value}
contentid={item}
/>
);
default:
return null;
Expand Down Expand Up @@ -330,6 +312,7 @@ const SearchPage = () => {
<main className="mt-22 ">
<div className="min-h-658">
{isLoading ? (
// <SkeletonLayout layout={layout} itemList={itemListLength} />
<SkeletonLayout layout={layout} itemList={itemListLength} />
) : (
<div className={layout === 'medium-layout' ? 'flex flex-wrap' : ''}>
Expand Down

0 comments on commit 9127b36

Please sign in to comment.