Skip to content

Commit

Permalink
Fix: change wish null icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Yamyam-code committed Jan 28, 2024
1 parent bed786d commit 157376c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
13 changes: 11 additions & 2 deletions src/components/SearchFromHome/SearchList/SearchItem/SearchItem.tsx
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 './SearchItem.module.scss';

Expand All @@ -22,9 +22,18 @@ function SearchItem({forSearch, data, categoryChange}: PropsType) {
const location = areas.filter((area) => area.areaCode === data.location.areaCode)[0].name;
const category = translateCategoryToStr(data.contentTypeId);
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}`;
console.log(path);

return (
<Link to={`/detail/${data.id} ${data.contentTypeId}?title=${data.title}`} className={styles.container}>
<Link to={detailLink} className={styles.container}>
<div className={styles.itemBox}>
<img
src={imgSrc}
Expand Down
12 changes: 10 additions & 2 deletions src/components/WishItem/WishItem.tsx
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 './WishItem.module.scss';

Expand All @@ -25,9 +25,17 @@ function WishItem({filter, data, categoryChange}: PropsType) {
const location = areas.filter((area) => area.areaCode === data.location.areaCode)[0].name;
const category = translateCategoryToStr(data.contentTypeId);
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}>
<div className={styles.itemBox}>
<img
src={imgSrc}
Expand Down

0 comments on commit 157376c

Please sign in to comment.