Skip to content

Commit

Permalink
fix: put description under image
Browse files Browse the repository at this point in the history
  • Loading branch information
jsapro committed Jan 11, 2024
1 parent 266e9e8 commit e93fc5e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
4 changes: 3 additions & 1 deletion src/components/recipes-components/recipe-info/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useParams } from 'react-router';

type RecipeInfoProps = {
img: string;
description: string;
recipeNutrients: {
proteins: number;
fats: number;
Expand All @@ -12,12 +13,13 @@ type RecipeInfoProps = {
};
};

const RecipeInfo: React.FC<RecipeInfoProps> = ({ img, recipeNutrients }) => {
const RecipeInfo: React.FC<RecipeInfoProps> = ({ img, description, recipeNutrients }) => {
const { id } = useParams();
return (
<div className={styles['recipe-info']}>
<div className={styles['recipe-info__image']}>
<img src={img} alt={id} />
<p className={styles['recipe-info__description']}>{description}</p>
</div>
<p className={styles['recipe-info__info']}>Энергетическая ценность на порцию</p>
<EnergyValue {...recipeNutrients} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@
}
}

&__description {
margin: 0;
font-size: 20px;
line-height: 140%;
margin-bottom: 20px;
}

&__info {
margin: 0;
font-size: 22px;
font-weight: 500;
line-height: 140%;
margin-bottom: 8px;
}

&__description {
margin: 0;
padding-top: 16px;
font-size: 20px;
font-weight: 400;
line-height: 140%;
}
}
8 changes: 6 additions & 2 deletions src/pages/recipe/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,17 @@ const Recipe: React.FC = () => {
</p>
</div>
<div className={styles.recipes__info}>
<RecipeInfo img={recipeInfo.image} recipeNutrients={recipeNutrients} />
<RecipeInfo
img={recipeInfo.image}
recipeNutrients={recipeNutrients}
description={recipeByLines[1]}
/>
</div>
</div>
<div className={clsx(styles.recipes__instructions, styles.instructions)}>
<p className={styles.instructions__title}>Инструкция приготовления</p>
<div className={styles.instructions__list}>
{recipeByLines.map((line, index) => (
{recipeByLines.slice(2).map((line, index) => (
<p key={index} className={styles.instructions__item}>
{line}
</p>
Expand Down
4 changes: 0 additions & 4 deletions src/pages/recipe/recipe.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@
margin-bottom: 25px;
}

&__item:first-child {
font-weight: 500;
}

&__item:last-child {
margin: 0;
}
Expand Down

0 comments on commit e93fc5e

Please sign in to comment.