Filtering By Grades Data Is Connected But Doesn't add Just Shows

temp
Pedram Keshavarzi 3 years ago
parent 7ead8d2a5f
commit b522fcea32
  1. 2
      src/views/Product/Desktop/ProductOverAll/index.js
  2. 5
      src/views/Products/index.js
  3. 23
      src/views/Products/layouts/Main.js
  4. 8
      src/views/Products/layouts/Sidebar.js

@ -118,7 +118,7 @@ export const ProductOverAll = ({
sendingTime={20} sendingTime={20}
numberOfSuggest={160} numberOfSuggest={160}
profit={12000} profit={12000}
// showProduct showProduct
productCat={grades[book?.gradeId]} productCat={grades[book?.gradeId]}
productImg={`https://dnvn.ir/api/v1/file/${book?.fileIds}`} productImg={`https://dnvn.ir/api/v1/file/${book?.fileIds}`}
productName={type === "digital" productName={type === "digital"

@ -47,6 +47,8 @@ export const Products = ({
gradeFilter(filter.grade); gradeFilter(filter.grade);
}, [filter]); }, [filter]);
const Product = ({ productsType, product, index }) => { const Product = ({ productsType, product, index }) => {
return ( return (
<> <>
@ -148,6 +150,7 @@ export const Products = ({
/> />
)) ))
: books?.map((product, index) => ( : books?.map((product, index) => (
<Product <Product
key={index} key={index}
productsType={filter.productsType} productsType={filter.productsType}
@ -163,7 +166,7 @@ export const Products = ({
// style={{ height: 1500 }} // style={{ height: 1500 }}
> >
<Sidebar onChange={onChange}/> <Sidebar onChange={onChange}/>
<Main /> <Main filter={filter}/>
</div> </div>
)} )}
</div> </div>

@ -15,17 +15,9 @@ export const Main = ({ isMobile,
selectedGrade, selectedGrade,
gradeFilterBooks, gradeFilterBooks,
setHeaderOptions, setHeaderOptions,
headerOptions, }) => { headerOptions,
const [filter, setFilter] = useState({ filter }) => {
search: "",
grade: "",
productsType: "کتاب",
});
const [desktopContentTransform, setDesktopContentTransform] = useState(false);
const onChange = (name, value) => {
setFilter({ ...filter, [name]: value });
};
const filteringNavItems = [ const filteringNavItems = [
{ {
@ -60,7 +52,7 @@ export const Main = ({ isMobile,
} }
</ul> </ul>
</div> </div>
<div className="w-full flex flex-row flex-wrap mt-0 border-t-2 border-solid border-gray-100 overflow-y-hidden justify-between"> <div className="w-full flex flex-row flex-wrap mt-0 border-t-2 border-solid border-gray-100 overflow-y-hidden justify-between">
{selectedGrade {selectedGrade
? gradeFilterBooks?.map((product, index) => ( ? gradeFilterBooks?.map((product, index) => (
@ -70,6 +62,15 @@ export const Main = ({ isMobile,
product={product} product={product}
index={Number(index)} index={Number(index)}
grades={grades} grades={grades}
roductName={`کتاب ${product?.name}`}
productCat={`پایه ${grades[product?.gradeId]}`}
productPrice={100000}
productImg={"https://dnvn.ir/api/v1/file/" + product?.fileIds}
numberOfRegards={160}
productTitleColor='text-blue5F'
productCatTextColor='text-blueC0'
productHolderBorder=''
productHolderHoverBorder='shadow-md'
/> />
)) ))
: books?.map((product, index) => ( : books?.map((product, index) => (

@ -59,10 +59,10 @@ export const Sidebar = ({onChange}) => {
}, },
] ]
return <div className="flex flex-col w-1/4 p-4"> return <div className="flex flex-col w-1/4 p-4">
<VerticalExpandableProductFilter onChange={onChange} name="grade" preName='پایه' btnTitle='مشاهده همه ی کالاهای آموزشی' list={filteronGrade} title="پایه تحصیلی" searchAble={true}/> <VerticalExpandableProductFilter onChange={onChange} name="grade" preName='پایه' btnTitle='مشاهده همه ی کالاهای آموزشی' list={filteronGrade} title="پایه تحصیلی" searchAble={true}/>
<VerticalExpandableProductFilter name="category" list={categories} title="دسته بندی" searchAble={false}/> <VerticalExpandableProductFilter name="category" list={categories} title="دسته بندی" searchAble={false}/>
</div>; </div>;
}; };
const mapStateToProps = (state) => ({}); const mapStateToProps = (state) => ({});

Loading…
Cancel
Save