diff --git a/src/pages/ItemDetailPage/components/ItemComments.jsx b/src/pages/ItemDetailPage/components/ItemComments.tsx similarity index 87% rename from src/pages/ItemDetailPage/components/ItemComments.jsx rename to src/pages/ItemDetailPage/components/ItemComments.tsx index 0a550a674..fa0c75f0d 100644 --- a/src/pages/ItemDetailPage/components/ItemComments.jsx +++ b/src/pages/ItemDetailPage/components/ItemComments.tsx @@ -1,11 +1,12 @@ import React, { useEffect, useState } from "react"; import { useParams } from "react-router-dom"; import { getProductCommentsById } from "../../../api/itemApi"; -import NoneCommentsImg from "../../../assets/images/img_nonecomment.png"; +import NoneCommentsImg from "../../../assets/images/icons/img_nonecomment.svg"; +import { Comment } from "../../../types/Items"; function ItemComments() { const { itemId } = useParams(); - const [comments, setCommnets] = useState(); + const [comments, setCommnets] = useState(); const fetch = async () => { try { @@ -16,8 +17,8 @@ function ItemComments() { } }; - function formatTime(time) { - const elapsed = (new Date() - new Date(time)) / 1000; + function formatTime(time: Date) { + const elapsed = (new Date().getTime() - new Date(time).getTime()) / 1000; const intervals = { 일: 86400, diff --git a/src/pages/MarketPage/components/ItemCard.jsx b/src/pages/MarketPage/components/ItemCard.tsx similarity index 79% rename from src/pages/MarketPage/components/ItemCard.jsx rename to src/pages/MarketPage/components/ItemCard.tsx index 226c06baa..b5485d83e 100644 --- a/src/pages/MarketPage/components/ItemCard.jsx +++ b/src/pages/MarketPage/components/ItemCard.tsx @@ -1,7 +1,14 @@ import React from "react"; import { ReactComponent as HeartIcon } from "../../../assets/images/icons/ic_heart.svg"; -function ItemCard({ item }) { +interface Item { + images: string[]; + name: string; + favoriteCount: number; + price: number; +} + +function ItemCard({ item }: { item: Item }) { return (
{item.name}