Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed src/assets/css/default.css
Empty file.
4 changes: 4 additions & 0 deletions src/assets/css/recipe/recipe.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.recipe-wrapper {
display: flex;
gap: 20px;
}
Binary file added src/assets/image/recipeimage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file removed src/components/recipe/default.jsx
Empty file.
17 changes: 17 additions & 0 deletions src/components/recipe/recipeItem.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import recipeImage from "../../assets/image/recipeimage.png"

const RecipeItem = ({ recipe }) => {
return (
<div >
<img src={recipeImage} alt="Default Recipe Image" style={{ width: '100px', height: 'auto' }} />
<p>사진:{recipe.recipeSource}</p>
<h3>이름:{recipe.recipeName}</h3>
<p>내용:{recipe.recipeContent}</p>
<p>조리시간:{recipe.recipeCookingTime}(단위)</p>
<p>난이도:{recipe.recipeDifficulty}</p>
<p>조회수:{recipe.recipeViews}</p>
</div>
);
};

export default RecipeItem
9 changes: 8 additions & 1 deletion src/pages/recipe/Recipe.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { useEffect, useState,useCallback } from "react"
import { getRecipeList } from "../../sources/api/recipeAPI.jsx";
import {Route, useNavigate} from "react-router-dom";
import { AddRecipe} from "./addRecipe.jsx";
import RecipeItem from "../../components/recipe/recipeItem.jsx"
import "../../assets/css/recipe/recipe.css"

function Recipe() {
const [recipeList, setRecipeList] = useState([])
Expand All @@ -11,8 +13,8 @@ function Recipe() {
const fetchRecipes = async () => {
try {
const data = await getRecipeList();
console.log("recipeList",data); // 가져온 데이터 확인
setRecipeList(data); // 상태 업데이트
console.log(recipeList); // 가져온 데이터 확인
} catch (err) {
console.error(err);
}
Expand All @@ -28,6 +30,11 @@ function Recipe() {
return (
<>
<h1>레시피 페이지</h1>
<div className="recipe-wrapper">
{recipeList.map((recipe) => (
<RecipeItem key={recipe.recipePk} recipe={recipe} />
))}
</div>
<ul>
<li>
<button onClick={handleAdd}>add button</button>
Expand Down
1 change: 1 addition & 0 deletions src/pages/recipe/addRecipe.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export const AddRecipe = () => {
// 파일 업로드 처리
const handleRecipeSourcesChange = (e) => {
setRecipeSources(Array.from(e.target.files)); // 여러 파일을 배열로 추가
console.log(Array.from(e.target.files))
};


Expand Down