добавил навигацию на катекории и сброс выбранной категории при переходе на страницу каталога

This commit is contained in:
Joe_Peach committed 2026-04-21 16:21:41 +03:00
1 parent b229b5b84c
commit 530f583727
3 files changed
+17 -3

No files matched your search

+9
View File
@@ -3,6 +3,15 @@
min-height: 100vh;
}
.resetLink {
text-decoration: none;
color: inherit;
cursor: pointer;
font-size: 16px;
color: #f5c400;
}
.top {
background: #000;
padding: 15px 40px;
+4 -2
View File
@@ -1,13 +1,15 @@
import { useEffect, useState } from "react";
import { useParams, useNavigate } from "react-router-dom";
import { useAppDispatch, useAppSelector } from "../../app/hooks";
import { fetchProductById } from "../../features/catalog/productsSlice";
import { fetchProductById, setSelectedProducts } from "../../features/catalog/productsSlice";
import styles from "./ItemPage.module.css";
import type { CategoryAtributes, CategoryAtrVals } from "../../types/categories";
import Button from "../../components/Button/Button";
import PriceLisForm from "../../components/PriceLisForm/PriceLisForm";
import ProductAttributes from "../../components/Table/ProducTable";
import { p, title } from "framer-motion/client";
import Link from "antd/es/typography/Link";
import { setSelectedCategory } from "../../features/catalog/categoriesSlice";
const ItemPage = () => {
const { id } = useParams();
@@ -47,7 +49,7 @@ const ItemPage = () => {
<div className={styles.right}>
<div className={styles.rightContent}>
<div className={styles.breadcrumbs}>
ГЛАВНАЯ / {category?.name} / {product.name}
<Link onClick={() => {navigate('/products'); dispatch(setSelectedCategory(null))}} style={{ textDecoration: 'none', color: 'inherit', fontSize: "16px" }}>КАТЕГОРИИ</Link> / <Link onClick={() => navigate('/products')} style={{ textDecoration: 'none', color: 'inherit', fontSize: "16px" }}>{category?.name}</Link> / <Link onClick={() => navigate(`/product/${id}`)} style={{ textDecoration: 'none', color: 'inherit', fontSize: "16px" }}>{product.name}</Link>
</div>
<h1 className={styles.title}>{product.name}</h1>