diff --git a/src/assets/icons/default-profile.svg b/src/assets/icons/default-profile.svg new file mode 100644 index 0000000..9d33eac --- /dev/null +++ b/src/assets/icons/default-profile.svg @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/src/assets/icons/index.ts b/src/assets/icons/index.ts index 320b328..ba61255 100644 --- a/src/assets/icons/index.ts +++ b/src/assets/icons/index.ts @@ -14,6 +14,7 @@ import CheckIcon from './check.svg?react'; import ClockIcon from './clock.svg?react'; import CloseIcon from './close.svg?react'; import CommentIcon from './comment.svg?react'; +import DefaultProfileIcon from './default-profile.svg?react'; import DownChevronIcon from './down-chevron.svg?react'; import GoogleIcon from './google.svg?react'; import HideIcon from './hide.svg?react'; @@ -51,6 +52,7 @@ export { ClockIcon, CloseIcon, CommentIcon, + DefaultProfileIcon, DownChevronIcon, GoogleIcon, HideIcon, diff --git a/src/components/Home/Comment/Comment.tsx b/src/components/Home/Comment/Comment.tsx index a78f60e..a1f5e61 100644 --- a/src/components/Home/Comment/Comment.tsx +++ b/src/components/Home/Comment/Comment.tsx @@ -3,6 +3,7 @@ import React from 'react'; import { useReactComment } from '@apis/comment/useComment'; import { Col, Row } from '@components/commons/Flex/Flex'; +import ProfileImg from '@components/commons/ProfileImg/ProfileImg'; import Text from '@components/commons/Text/Text'; import useModal from '@hooks/useModal/useModal'; import { CommentResponse } from '@interfaces/api/comment'; @@ -69,7 +70,7 @@ const Comment = React.memo(({ comment }: CommentProps) => { - + diff --git a/src/components/Home/TopicComments/TopicComments.tsx b/src/components/Home/TopicComments/TopicComments.tsx index 6b42656..3734e9c 100644 --- a/src/components/Home/TopicComments/TopicComments.tsx +++ b/src/components/Home/TopicComments/TopicComments.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { memo, useState } from 'react'; import { useComments, useCreateComment } from '@apis/comment/useComment'; import { Row } from '@components/commons/Flex/Flex'; @@ -21,7 +21,7 @@ interface TopicCommentsProps { topic: TopicResponse; } -const TopicComments = ({ topic }: TopicCommentsProps) => { +const TopicComments = memo(({ topic }: TopicCommentsProps) => { const { data: comments, fetchNextPage } = useComments( topic.topicId, topic.selectedOption !== null @@ -71,6 +71,6 @@ const TopicComments = ({ topic }: TopicCommentsProps) => { ); -}; +}); export default TopicComments; diff --git a/src/components/commons/ProfileImg/ProfileImg.tsx b/src/components/commons/ProfileImg/ProfileImg.tsx new file mode 100644 index 0000000..38eb7b9 --- /dev/null +++ b/src/components/commons/ProfileImg/ProfileImg.tsx @@ -0,0 +1,35 @@ +import React from 'react'; + +import { DefaultProfileIcon } from '@icons/index'; + +interface ProfileImgProps { + url: string | null; + size?: string | number; + rounded?: boolean; +} + +const ProfileImg = ({ url, size = '100%', rounded = true }: ProfileImgProps) => { + if (!url) { + return ( +
+ +
+ ); + } + + return ( + 프로필 이미지 + ); +}; + +export default ProfileImg; diff --git a/src/hooks/useBottomSheet/useBottomSheet.tsx b/src/hooks/useBottomSheet/useBottomSheet.tsx index 25ae377..495ce6e 100644 --- a/src/hooks/useBottomSheet/useBottomSheet.tsx +++ b/src/hooks/useBottomSheet/useBottomSheet.tsx @@ -28,7 +28,7 @@ const useBottomSheet = (props: UseBottomSheetProps) => { ); - return { BottomSheet: isOpen ? Sheet : () => null, toggleSheet }; + return { BottomSheet: Sheet, toggleSheet }; }; export default useBottomSheet;