Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/small fixes2 #250

Merged
merged 3 commits into from
Jan 11, 2024
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
1 change: 1 addition & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function App() {
path={'payment-cancelled'}
element={<PaymentResults isPaid={false} />}
/>
<Route path="/404" element={<NotFound />} />
<Route path="*" element={<NotFound />} />
</Routes>
</Layout>
Expand Down
2 changes: 2 additions & 0 deletions src/components/Button/button.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
width: 100%;
height: 50px;
cursor: pointer;
white-space: nowrap;

&:not(.green-border-button__active):hover {
color: white;
Expand Down Expand Up @@ -167,6 +168,7 @@
width: 100%;
height: 50px;
transition: 0.5s;
white-space: nowrap;

@media screen and (width <= 768px) {
font-size: 13px;
Expand Down
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%;
}
}
2 changes: 1 addition & 1 deletion src/pages/category/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const Category: React.FC = () => {
setCategoryObj(data.results[0]?.category);
})
.catch(() => {
navigate('/упс');
navigate('/404');
})
.finally(() => {
setIsLoading(false);
Expand Down
4 changes: 2 additions & 2 deletions src/pages/product/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const Product: React.FC = () => {
.then((data) => setProductItem(data))
.catch((error) => {
console.log(error);
navigate('/упс');
navigate('/404');
});
api
.reviewsList(Number(id))
Expand All @@ -58,7 +58,7 @@ const Product: React.FC = () => {
.catch((err) => console.log(err));
} else {
console.log('ID is undefined');
navigate('/упс');
navigate('/404');
}
}, [id, navigate]);

Expand Down
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
Loading