Skip to content

Commit

Permalink
Merge pull request #278 from Strong-Potato/248-fix-vote-slide
Browse files Browse the repository at this point in the history
Fix: search hot items detail link
  • Loading branch information
Yamyam-code authored Jan 28, 2024
2 parents 2594eda + c0a7798 commit 15a38ff
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/SearchFromHome/MapHeader/MapHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function MapHeader({forSearch, setForSearch}: PropsType) {

function offMap() {
if (forSearch.placeID !== 'undefined') {
history.back();
navigate(`/trip/${forSearch.placeID}`);
} else {
const before = forSearch;
before.map = 'false';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Link} from 'react-router-dom';
import {Link, useSearchParams} from 'react-router-dom';

import styles from './HotItem.module.scss';

Expand All @@ -18,9 +18,17 @@ function HotItem({data}: PropsData) {
const category = translateCategoryToStr(data.contentTypeId);
const title = titleCaseChange(data.title);
const imgSrc = data.thumbnail ? data.thumbnail : nullImg;
const [searchPrams] = useSearchParams();
const tripId = searchPrams.get('placeID');
const journyId = searchPrams.get('tripDate')?.split(' ')[1];
const path = searchPrams.get('tripDate')?.split(' ')[0];
const detailLink =
path === 'trip'
? `/detail/${data.id} ${data.contentTypeId}?title=${data.title}&tripId=${tripId}&journyId=${journyId}`
: `/detail/${data.id} ${data.contentTypeId}?title=${data.title}`;

return (
<Link to={`/detail/${data.id} ${data.contentTypeId}?title=${data.title}`} className={styles.container}>
<Link to={detailLink} className={styles.container}>
<img src={imgSrc} alt={`${data.title}의 사진`} style={{padding: data.thumbnail ? 0 : '30px'}} />
<p className={styles.text_box}>
<span className={styles.title}>{title}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ function SearchItem({forSearch, data, categoryChange}: PropsType) {
path === 'trip'
? `/detail/${data.id} ${data.contentTypeId}?title=${data.title}&tripId=${tripId}&journyId=${journyId}`
: `/detail/${data.id} ${data.contentTypeId}?title=${data.title}`;
console.log(path);

return (
<Link to={detailLink} className={styles.container}>
Expand Down
4 changes: 0 additions & 4 deletions src/pages/SearchFromHome/SearchFromHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ function SearchFromHome() {
}
}, [searchParams]);

useEffect(() => {
console.log(forSearch);
}, [forSearch]);

return (
<div
className={styles.container}
Expand Down

0 comments on commit 15a38ff

Please sign in to comment.