Skip to content

Commit 9789549

Browse files
committed
✨ Feat: 포스트 검색 결과에서 해당 항목 클릭 시 항목 상세 정보로 이동
1 parent a9f0414 commit 9789549

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/PostPreview/PostPreview.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import {
77
PreviewContainer
88
} from './PostPreview.style';
99
import { Link } from '@components/Link';
10+
import { openSearch } from '@pages/layout/states/openSearch';
11+
import { useSetRecoilState } from 'recoil';
1012

1113
interface PostPreviewProps {
1214
post: EditedPost;
@@ -25,9 +27,13 @@ const PostPreview = ({
2527
const previewContent = `${content.substring(0, 100)}${
2628
content.length > 100 ? '...' : ''
2729
}`;
30+
const setResultShown = useSetRecoilState(openSearch);
31+
const handlePreviewClick = () => {
32+
setResultShown(false);
33+
};
2834

2935
return (
30-
<PreviewContainer>
36+
<PreviewContainer onClick={handlePreviewClick}>
3137
<PostHeaderContainer>
3238
<PostHeader
3339
post={post}

0 commit comments

Comments
 (0)