Skip to content

Commit

Permalink
✨ Feat: 포스트 검색 결과에서 해당 항목 클릭 시 항목 상세 정보로 이동
Browse files Browse the repository at this point in the history
✨ Feat: 포스트 검색 결과에서 해당 항목 클릭 시 항목 상세 정보로 이동
  • Loading branch information
sscoderati authored Sep 27, 2023
2 parents a9f0414 + 9789549 commit a3f366c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/PostPreview/PostPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
PreviewContainer
} from './PostPreview.style';
import { Link } from '@components/Link';
import { openSearch } from '@pages/layout/states/openSearch';
import { useSetRecoilState } from 'recoil';

interface PostPreviewProps {
post: EditedPost;
Expand All @@ -25,9 +27,13 @@ const PostPreview = ({
const previewContent = `${content.substring(0, 100)}${
content.length > 100 ? '...' : ''
}`;
const setResultShown = useSetRecoilState(openSearch);
const handlePreviewClick = () => {
setResultShown(false);
};

return (
<PreviewContainer>
<PreviewContainer onClick={handlePreviewClick}>
<PostHeaderContainer>
<PostHeader
post={post}
Expand Down

0 comments on commit a3f366c

Please sign in to comment.