|
1 | 1 | import React from 'react'; |
2 | 2 | import { useNavigate } from 'react-router-dom'; |
3 | | -import theme from '../../styles/theme'; |
4 | | -import { |
5 | | - PostItemContainer, |
6 | | - PostImageContainer, |
7 | | - PostImage, |
8 | | - LikesCountStyledText, |
9 | | - Icon, |
10 | | - LikesOverlay, |
11 | | - PinSvg, |
12 | | -} from './style'; |
13 | | -import HeartSvg from '../../assets/default/like.svg'; |
14 | | -import MessageSvg from '../../assets/default/message.svg'; |
15 | | -import PinIcon from '../../assets/default/pin.svg'; |
16 | | -import { PostItemProps } from './dto'; |
| 3 | + |
| 4 | +import theme from '@styles/theme'; |
| 5 | +import PinIcon from '@assets/default/pin.svg'; |
| 6 | +import Like from '@components/Icons/Like'; |
| 7 | +import Message from '@components/Icons/Message'; |
| 8 | + |
| 9 | +import type { PostItemProps } from './dto'; |
| 10 | +import { PostItemLayout, PostImageContainer, PostImage, LikesCountStyledText, LikesOverlay, Pin } from './style'; |
17 | 11 |
|
18 | 12 | const PostItem: React.FC<PostItemProps> = ({ post, isMyPost = true }) => { |
19 | 13 | const navigate = useNavigate(); |
20 | | - const imageUrl = post.imageUrl; |
| 14 | + const postImageUrl = post.imageUrl; |
21 | 15 |
|
22 | | - const handleClick = () => { |
| 16 | + const handlePostItemClick = () => { |
23 | 17 | const path = isMyPost ? `/my-post/${post.id}` : `/post/${post.id}`; |
24 | 18 | navigate(path); |
25 | 19 | }; |
26 | 20 |
|
27 | 21 | return ( |
28 | | - <PostItemContainer onClick={handleClick}> |
| 22 | + <PostItemLayout onClick={handlePostItemClick}> |
29 | 23 | <PostImageContainer> |
30 | | - <PostImage src={imageUrl} alt={`post-${post.id}`} /> |
31 | | - {post.isRepresentative && <PinSvg src={PinIcon} />} |
| 24 | + <PostImage src={postImageUrl} alt={`post-${post.id}`} /> |
| 25 | + {post.isRepresentative && <Pin src={PinIcon} />} |
32 | 26 | <LikesOverlay> |
33 | | - <Icon src={HeartSvg} alt="heart icon" /> |
| 27 | + <Like /> |
34 | 28 | <LikesCountStyledText $textTheme={{ style: 'caption1-regular' }} color={theme.colors.gray3}> |
35 | 29 | {post.postLikesCount} |
36 | 30 | </LikesCountStyledText> |
37 | | - <Icon src={MessageSvg} alt="message icon" /> |
| 31 | + <Message /> |
38 | 32 | <LikesCountStyledText $textTheme={{ style: 'caption1-regular' }} color={theme.colors.gray3}> |
39 | 33 | {post.postCommentsCount} |
40 | 34 | </LikesCountStyledText> |
41 | 35 | </LikesOverlay> |
42 | 36 | </PostImageContainer> |
43 | | - </PostItemContainer> |
| 37 | + </PostItemLayout> |
44 | 38 | ); |
45 | 39 | }; |
46 | 40 |
|
|
0 commit comments