diff --git a/src/features/recipes/components/recipe-details/RecipeDetails.jsx b/src/features/recipes/components/recipe-details/RecipeDetails.jsx index 66e5801..06c0de7 100644 --- a/src/features/recipes/components/recipe-details/RecipeDetails.jsx +++ b/src/features/recipes/components/recipe-details/RecipeDetails.jsx @@ -96,7 +96,7 @@ export const RecipeDetails = ({ recipe }) => {
- {alt} + {alt}
@@ -113,7 +113,7 @@ export const RecipeDetails = ({ recipe }) => { <> {topic.name} @@ -146,7 +146,7 @@ export const RecipeDetails = ({ recipe }) => { <> {tag.display_name} @@ -166,7 +166,7 @@ export const RecipeDetails = ({ recipe }) => { console.log("Scrolling to ", to); document.querySelector(to)?.scrollIntoView(); }} - className="w-full text-center justify-between text-lg my-4" + className="justify-between w-full my-4 text-lg text-center" >
{label}
@@ -180,7 +180,7 @@ export const RecipeDetails = ({ recipe }) => { return ; }); return ( -
+
@@ -237,7 +237,7 @@ export const RecipeDetails = ({ recipe }) => { const unit = component.measurements[0].unit; const isPlural = quantity > 1 ? true : false; const measurement = ( - + {quantity && quantity !== "0" ? quantity + " " : "-"} @@ -262,7 +262,7 @@ export const RecipeDetails = ({ recipe }) => { ); }); return ( -
+
{name || "You'll Need:"} @@ -290,13 +290,42 @@ export const RecipeDetails = ({ recipe }) => { ); }; + const NutritionSection = ({ nutrition }) => { + const { updated_at, ...rest } = nutrition; + return ( + <> +
+ {Object.entries(rest).map(([key, value]) => { + return ( +
+ + {key} + +

+ {value} + {key === "calories" ? "" : "g"} +

+
+ ); + })} +
+

+ {`Last updated on ${updated_at.slice(0, 10)}`} +

+ + ); + }; + const Instructions = ({ instructions }) => { return (
Preparation -
    +
      {instructions.map((step, index) => { const { display_text } = step; return ( @@ -312,7 +341,7 @@ export const RecipeDetails = ({ recipe }) => { return (
      -
      +
      {recipe.name} @@ -332,7 +361,7 @@ export const RecipeDetails = ({ recipe }) => {
      -
      +
      @@ -354,12 +383,12 @@ export const RecipeDetails = ({ recipe }) => {
      -
      +
      - +
      @@ -374,6 +403,7 @@ export const RecipeDetails = ({ recipe }) => { Nutrition + @@ -401,6 +431,7 @@ RecipeDetails.propTypes = { list: PropTypes.object, name: PropTypes.string, instructions: PropTypes.object, + nutrition: PropTypes.object, src: PropTypes.string, alt: PropTypes.string, };