diff --git a/apps/member/src/components/common/Card/Card.tsx b/apps/member/src/components/common/Card/Card.tsx new file mode 100644 index 00000000..6ada4a14 --- /dev/null +++ b/apps/member/src/components/common/Card/Card.tsx @@ -0,0 +1,50 @@ +import { useNavigate } from 'react-router-dom'; +import Image from '../Image/Image'; +import { createImageUrl } from '@utils/api'; +import classNames from 'classnames'; + +interface CardProps { + to?: string; + image?: string; + title: string; + description?: string; +} + +const Card = ({ to, image, title, description }: CardProps) => { + const navigate = useNavigate(); + + const handleCardClick = () => { + to && navigate(to); + }; + + return ( +
+ {image && ( + {title} + )} +
+

+ {title} +

+ {description && ( +

{description}

+ )} +
+
+ ); +}; + +export default Card; diff --git a/apps/member/src/components/common/NewsCard/NewsCard.tsx b/apps/member/src/components/common/NewsCard/NewsCard.tsx deleted file mode 100644 index fc68a8c4..00000000 --- a/apps/member/src/components/common/NewsCard/NewsCard.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import classNames from 'classnames'; -import Image from '../Image/Image'; -import { Link } from 'react-router-dom'; - -interface NewsCardProps { - to: string; - imageUrl?: string; - title: string; - description?: string; -} - -const NewsCard = ({ to, imageUrl, title, description }: NewsCardProps) => { - return ( - - {title} -
-

- {title} -

- {description && ( -

{description}

- )} -
- - ); -}; - -export default NewsCard; diff --git a/apps/member/src/components/main/NewsCardSection/NewsCardSection.tsx b/apps/member/src/components/main/NewsCardSection/NewsCardSection.tsx index 82b854ae..32153bba 100644 --- a/apps/member/src/components/main/NewsCardSection/NewsCardSection.tsx +++ b/apps/member/src/components/main/NewsCardSection/NewsCardSection.tsx @@ -1,9 +1,9 @@ -import NewsCard from '@components/common/NewsCard/NewsCard'; +import Card from '@components/common/Card/Card'; import Section from '@components/common/Section/Section'; import { COMMUNITY_MESSAGE } from '@constants/message'; import { PATH } from '@constants/path'; -import { BlogPostItem } from '@type/blog'; -import { CommunityPostItem } from '@type/community'; +import type { BlogPostItem } from '@type/blog'; +import type { CommunityPostItem } from '@type/community'; interface NewsCardSectionProps { to: string; @@ -24,7 +24,7 @@ const NewsCardSection = ({ to, title, data = [] }: NewsCardSectionProps) => {

) : ( data.map((news, index) => ( - + )) )} diff --git a/apps/member/src/components/my/MyActivityGroupSection/MyActivityGroupSection.tsx b/apps/member/src/components/my/MyActivityGroupSection/MyActivityGroupSection.tsx index 691bb30c..cd569587 100644 --- a/apps/member/src/components/my/MyActivityGroupSection/MyActivityGroupSection.tsx +++ b/apps/member/src/components/my/MyActivityGroupSection/MyActivityGroupSection.tsx @@ -1,4 +1,4 @@ -import NewsCard from '@components/common/NewsCard/NewsCard'; +import Card from '@components/common/Card/Card'; import Section from '@components/common/Section/Section'; import { PATH_FINDER } from '@constants/path'; import type { ActivityGroupMemberMyType } from '@type/activity'; @@ -13,10 +13,10 @@ const MyActivityGroupSection = ({ data }: MyActivityGroupSectionProps) => { {data.map((activityGroup) => ( -