+
전체 상품
+
-
+
상품 등록하기
-
-
+
+
-
+
{sortedItems.slice(0, 10).map((item) => (
-
+
))}
diff --git a/src/components/PandaBestList.jsx b/src/components/PandaBestList.jsx
deleted file mode 100644
index 366344720..000000000
--- a/src/components/PandaBestList.jsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import React, { useEffect, useState } from "react";
-import ItemCard from "./ItemCard";
-import { getItems } from "../api/itemApi";
-
-function PandaBestList() {
- const [listItems, setItems] = useState([]);
-
- useEffect(() => {
- getItems({ order: "favorite", pageSize: 10 }).then((data) => {
- const sortedItems = data
- .sort((a, b) => b.favoriteCount - a.favoriteCount)
- .slice(0, 4);
- setItems(sortedItems);
- });
- }, []);
-
- return (
-
-
베스트 상품
-
- {listItems.map((item) => (
-
- ))}
-
-
- );
-}
-
-export default PandaBestList;
diff --git a/src/components/PandaBestList.tsx b/src/components/PandaBestList.tsx
new file mode 100644
index 000000000..db90ff60f
--- /dev/null
+++ b/src/components/PandaBestList.tsx
@@ -0,0 +1,34 @@
+import React from "react";
+import ItemCard from "./ItemCard.tsx";
+import styles from "./pandaBestList.module.css";
+
+interface Item {
+ id: string;
+ name: string;
+ price: number;
+ images: string[];
+ favoriteCount: number;
+}
+
+interface PandaBestListProps {
+ items: Item[];
+}
+
+function PandaBestList({ items }: PandaBestListProps) {
+ const sortedItems = items
+ .sort((a, b) => b.favoriteCount - a.favoriteCount)
+ .slice(0, 4);
+
+ return (
+
+
베스트 상품
+
+ {sortedItems.map((item) => (
+
+ ))}
+
+
+ );
+}
+
+export default PandaBestList;
diff --git a/src/components/detailInquiry.css b/src/components/detailInquiry.module.css
similarity index 100%
rename from src/components/detailInquiry.css
rename to src/components/detailInquiry.module.css
diff --git a/src/components/itemCard.module.css b/src/components/itemCard.module.css
new file mode 100644
index 000000000..b3e0a90e9
--- /dev/null
+++ b/src/components/itemCard.module.css
@@ -0,0 +1,28 @@
+.itemName {
+ font-size: 14px;
+ margin-top: 16px;
+ color: #1f2937;
+}
+
+.itemPrice {
+ margin-top: 6px;
+ font-size: 16px;
+ font-weight: bold;
+ color: #1f2937;
+}
+
+.favorit {
+ display: flex;
+ gap: 4px;
+ margin-top: 6px;
+}
+
+.heartIcon {
+ width: 16px;
+ height: 16px;
+}
+
+.itemFavoritCount {
+ font-size: 12px;
+ color: #4b5563;
+}
diff --git a/src/components/Nav.css b/src/components/nav.module.css
similarity index 100%
rename from src/components/Nav.css
rename to src/components/nav.module.css
diff --git a/src/components/pandaAllList.module.css b/src/components/pandaAllList.module.css
new file mode 100644
index 000000000..a22e70718
--- /dev/null
+++ b/src/components/pandaAllList.module.css
@@ -0,0 +1,70 @@
+.itemPage {
+ display: flex;
+ margin-top: 70px;
+ width: 100%;
+ justify-content: center;
+}
+
+.itemPage-container {
+ width: 1201px;
+}
+
+.allList,
+.bestList {
+ display: flex;
+}
+.allList {
+ flex-wrap: wrap;
+ gap: 24px;
+}
+
+.allImg {
+ width: 221px;
+ height: 221px;
+ border-radius: 16px;
+}
+.title {
+ font-size: 20px;
+ font-weight: bold;
+ color: #111827;
+ margin-bottom: 24px;
+}
+
+.titleList {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+}
+
+.titleOption {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+}
+
+.searchInput {
+ width: 325px;
+ height: 42px;
+ background-color: #f3f4f6;
+ border-radius: 12px;
+ border: none;
+ margin: 0;
+}
+
+.searchInput > input::placeholder {
+ color: #9ca3af;
+ font-size: 16px;
+}
+
+.addItemBtn {
+ display: flex;
+ background-color: #3692ff;
+ font-size: 16px;
+ color: #ffffff;
+ border-radius: 8px;
+ width: 133px;
+ height: 42px;
+ align-items: center;
+ justify-content: center;
+ text-decoration: none;
+}
diff --git a/src/components/pandaBestList.module.css b/src/components/pandaBestList.module.css
new file mode 100644
index 000000000..e83ed61a0
--- /dev/null
+++ b/src/components/pandaBestList.module.css
@@ -0,0 +1,39 @@
+.bestListContainer {
+ margin-bottom: 40px;
+}
+
+.itemImg {
+ width: 282px;
+ height: 282px;
+ border-radius: 16px;
+}
+
+.bestList {
+ gap: 24px;
+}
+.itemPage {
+ display: flex;
+ margin-top: 70px;
+ width: 100%;
+ justify-content: center;
+}
+
+.itemPage-container {
+ width: 1201px;
+}
+
+.allList,
+.bestList {
+ display: flex;
+}
+.title {
+ font-size: 20px;
+ font-weight: bold;
+ color: #111827;
+ margin-bottom: 24px;
+}
+.bestImg {
+ width: 282px;
+ height: 282px;
+ border-radius: 16px;
+}
diff --git a/src/pages/AddItem.jsx b/src/pages/AddItem.tsx
similarity index 57%
rename from src/pages/AddItem.jsx
rename to src/pages/AddItem.tsx
index 8db1d154c..8a1227891 100644
--- a/src/pages/AddItem.jsx
+++ b/src/pages/AddItem.tsx
@@ -1,51 +1,53 @@
import React, { useState } from "react";
-import "./AddItem.css";
-import AddItemForm from "../components/AddItemForm";
-import AddImgForm from "../components/AddImgForm";
-import AddTagForm from "../components/AddTagForm";
+import styles from "./addItem.module.css";
+import AddItemForm from "../components/AddItemForm.tsx";
+import AddImgForm from "../components/AddImgForm.tsx";
+import AddTagForm from "../components/AddTagForm.tsx";
-function AddItem() {
+const AddItem: React.FC = () => {
const [name, setName] = useState("");
const [description, setDescription] = useState("");
const [price, setPrice] = useState("");
- const [tags, setTags] = useState([]);
+ const [tags, setTags] = useState
([]);
- const addTag = (tag) => {
+ const addTag = (tag: string) => {
if (!tags.includes(tag)) {
setTags([...tags, tag]);
}
};
- const removeTag = (tagToRemove) => {
+ const removeTag = (tagToRemove: string) => {
setTags(tags.filter((tag) => tag !== tagToRemove));
};
- const handleSubmit = (e) => {
+ const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
};
- const handleNameChange = (e) => {
- setName(e.target.value);
- };
-
- const handleDescriptionChange = (e) => {
- setDescription(e.target.value);
- };
+ const handleChange = (
+ e: React.ChangeEvent
+ ) => {
+ const { id, value } = e.target;
- const handlePriceChange = (e) => {
- setPrice(e.target.value);
+ if (id === "name") {
+ setName(value);
+ } else if (id === "description") {
+ setDescription(value);
+ } else if (id === "price") {
+ setPrice(value);
+ }
};
const isSubmitDisabled = !name || !description || !price || !tags.length;
return (
-