diff --git a/web/src/components/icons/ServingSizeIconSmall.tsx b/web/src/components/icons/ServingSizeIconSmall.tsx new file mode 100644 index 0000000..6b5b342 --- /dev/null +++ b/web/src/components/icons/ServingSizeIconSmall.tsx @@ -0,0 +1,16 @@ + +export default function ServingSizeIconSmall() { + return <> + + + + + + + + +} diff --git a/web/src/components/icons/StarIconSmall.tsx b/web/src/components/icons/StarIconSmall.tsx new file mode 100644 index 0000000..e377ec3 --- /dev/null +++ b/web/src/components/icons/StarIconSmall.tsx @@ -0,0 +1,25 @@ + +interface StarIconSmallProps { + filled: boolean; +}; + +export default function StarIconSmall({ filled }: StarIconSmallProps) { + + return <> + {filled ? ( + + + + + + ) : ( + + + + + + )} + +} diff --git a/web/src/components/icons/TimeIconSmall.tsx b/web/src/components/icons/TimeIconSmall.tsx new file mode 100644 index 0000000..317d878 --- /dev/null +++ b/web/src/components/icons/TimeIconSmall.tsx @@ -0,0 +1,9 @@ +export default function TimeIconSmall() { + return <> + + + + ; +} diff --git a/web/src/components/results/FavoriteResult.tsx b/web/src/components/results/FavoriteResult.tsx new file mode 100644 index 0000000..9fd14a1 --- /dev/null +++ b/web/src/components/results/FavoriteResult.tsx @@ -0,0 +1,56 @@ + +import type { Recipe } from "../../types/recipe"; +import ServingSizeIconSmall from "../icons/ServingSizeIconSmall"; +import StarIconSmall from "../icons/StarIconSmall"; +import TimeIconSmall from "../icons/TimeIconSmall"; + +interface FavoriteResultProps { + recipe: Recipe; +}; + +export default function FavoriteResult({ recipe }: FavoriteResultProps) { + + return <> +
+ +
+
+
+

+ {recipe.Title} {recipe.Category} +

+
+ + + {recipe.Duration.Total} min + + + {Array.from({ length: recipe.Difficulty }).map((_, i) => ( + + ))} + {Array.from({ length: 5 - recipe.Difficulty }).map((_, i) => ( + + ))} + + + + Serves {recipe.Serves} + +
+
+
+ + + +
+
+

+ {recipe.Description} +

+
+
+ ; +} diff --git a/web/src/pages/Favorites.tsx b/web/src/pages/Favorites.tsx index bf231a5..5872c98 100644 --- a/web/src/pages/Favorites.tsx +++ b/web/src/pages/Favorites.tsx @@ -1,7 +1,111 @@ +import { useEffect, useState } from "react"; +import Banner from "../components/Banner"; +import RecipeSearchBar from "../components/inputs/RecipeSearchBar"; + +import type { Recipe } from "../types/recipe"; +import FavoriteResult from "../components/results/FavoriteResult"; + export default function Favorites() { + const [recipes, setRecipes] = useState([]); + + // BUG: Remove this + useEffect(() => { + const recipe: Recipe = { + Id: 1, + Title: "Classic Pancakes", + Description: "Fluffy and delicious pancakes perfect for breakfast.", + Instructions: [ + "In a bowl, mix all the dry ingredients.", + "In another bowl, whisk the wet ingredients.", + "Combine both mixes until smooth.", + "Heat a non-stick skillet and pour batter.", + "Cook until bubbles form, flip and cook the other side.", + "Serve warm with syrup." + ], + Serves: 4, + Difficulty: 2, // scale 1-5 (example) + Duration: { + Total: 20, + Prep: 5, + Cook: 15 + }, + Category: "breakfast", + Ingredients: [ + { Name: "Flour", Quantity: "2 cups" }, + { Name: "Milk", Quantity: "1.5 cups" }, + { Name: "Egg", Quantity: "1 large" }, + { Name: "Baking Powder", Quantity: "2 teaspoons" }, + { Name: "Salt", Quantity: "0.5 teaspoon" }, + { Name: "Sugar", Quantity: "1 tablespoon" } + ], + UserId: 101, + Modified: new Date("2025-10-30T09:00:00"), + Created: new Date("2025-10-01T08:30:00"), + Tags: [ + { Id: 1, Name: "easy", Created: new Date("2025-01-01T12:00:00") }, + { Id: 2, Name: "quick", Created: new Date("2025-01-02T12:00:00") }, + { Id: 3, Name: "breakfast", Created: new Date("2025-01-03T12:00:00") } + ], + Favorite: true + }; + + const recipe2: Recipe = { + Id: 2, + Title: "Classic Pancakes", + Description: "Fluffy and delicious pancakes perfect for breakfast.", + Instructions: [ + "In a bowl, mix all the dry ingredients.", + "In another bowl, whisk the wet ingredients.", + "Combine both mixes until smooth.", + "Heat a non-stick skillet and pour batter.", + "Cook until bubbles form, flip and cook the other side.", + "Serve warm with syrup." + ], + Serves: 4, + Difficulty: 2, // scale 1-5 (example) + Duration: { + Total: 20, + Prep: 5, + Cook: 15 + }, + Category: "breakfast", + Ingredients: [ + { Name: "Flour", Quantity: "2 cups" }, + { Name: "Milk", Quantity: "1.5 cups" }, + { Name: "Egg", Quantity: "1 large" }, + { Name: "Baking Powder", Quantity: "2 teaspoons" }, + { Name: "Salt", Quantity: "0.5 teaspoon" }, + { Name: "Sugar", Quantity: "1 tablespoon" } + ], + UserId: 101, + Modified: new Date("2025-10-30T09:00:00"), + Created: new Date("2025-10-01T08:30:00"), + Tags: [ + { Id: 1, Name: "easy", Created: new Date("2025-01-01T12:00:00") }, + { Id: 2, Name: "quick", Created: new Date("2025-01-02T12:00:00") }, + { Id: 3, Name: "breakfast", Created: new Date("2025-01-03T12:00:00") } + ], + Favorite: true + }; + + setRecipes([recipe, recipe2]); + }, []); + return ( <> -

Favorites

+ + +
+
+ {recipes.length < 1 ? ( +

No results

+ ) : ( + <> + {recipes.map(recipe => )} +

End of results

+ + )} +
); }