|
|
@ -32,27 +32,6 @@ class Products extends Component { |
|
|
|
subject: [], |
|
|
|
subject: [], |
|
|
|
sort: null, |
|
|
|
sort: null, |
|
|
|
}, |
|
|
|
}, |
|
|
|
sortFilters: [ |
|
|
|
|
|
|
|
{ id: 0, value: "مرتب سازی" }, |
|
|
|
|
|
|
|
{ id: 1, value: "محبوب ترین" }, |
|
|
|
|
|
|
|
{ id: 2, value: "جدیدترین" }, |
|
|
|
|
|
|
|
{ id: 3, value: "ارزان ترین" }, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
subjectFilters: [ |
|
|
|
|
|
|
|
{ id: 0, value: "نام کتاب" }, |
|
|
|
|
|
|
|
{ id: 1, value: "ریاضی" }, |
|
|
|
|
|
|
|
{ id: 2, value: "شیمی" }, |
|
|
|
|
|
|
|
{ id: 3, value: "علوم" }, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
levelFilters: [ |
|
|
|
|
|
|
|
{ id: 0, value: "پایه تحصیلی" }, |
|
|
|
|
|
|
|
{ id: 1, value: "اول" }, |
|
|
|
|
|
|
|
{ id: 2, value: "دوم" }, |
|
|
|
|
|
|
|
{ id: 3, value: "سوم" }, |
|
|
|
|
|
|
|
{ id: 4, value: "چهارم" }, |
|
|
|
|
|
|
|
{ id: 5, value: "دهم" }, |
|
|
|
|
|
|
|
{ id: 6, value: "هفتم" }, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
handleProductSearch = (val) => { |
|
|
|
handleProductSearch = (val) => { |
|
|
@ -79,7 +58,7 @@ class Products extends Component { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
render() { |
|
|
|
const { levelFilters, subjectFilters, sortFilters } = this.state; |
|
|
|
const { sortFilters, levels, subjects } = this.props; |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
{window.innerWidth > 1000 ? ( |
|
|
|
{window.innerWidth > 1000 ? ( |
|
|
@ -88,7 +67,9 @@ class Products extends Component { |
|
|
|
<Navbar page={"products"} /> |
|
|
|
<Navbar page={"products"} /> |
|
|
|
<Breadcrumbs /> |
|
|
|
<Breadcrumbs /> |
|
|
|
<div className="products__body d-flex"> |
|
|
|
<div className="products__body d-flex"> |
|
|
|
|
|
|
|
{this.props.subjects.length > 0 ? ( |
|
|
|
<Filters parent={this} /> |
|
|
|
<Filters parent={this} /> |
|
|
|
|
|
|
|
) : null} |
|
|
|
<div className="products__body--left d-flex flex-column"> |
|
|
|
<div className="products__body--left d-flex flex-column"> |
|
|
|
<Sort |
|
|
|
<Sort |
|
|
|
parent={this} |
|
|
|
parent={this} |
|
|
@ -117,8 +98,8 @@ class Products extends Component { |
|
|
|
<div className="mobile-products__filters d-flex"> |
|
|
|
<div className="mobile-products__filters d-flex"> |
|
|
|
<div className="d-flex"> |
|
|
|
<div className="d-flex"> |
|
|
|
<Select name="sort" options={sortFilters} parent={this} /> |
|
|
|
<Select name="sort" options={sortFilters} parent={this} /> |
|
|
|
<Select name="level" options={subjectFilters} parent={this} /> |
|
|
|
<Select name="subject" options={subjects} parent={this} /> |
|
|
|
<Select name="subject" options={levelFilters} parent={this} /> |
|
|
|
<Select name="level" options={levels} parent={this} /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<FilterListIcon style={{ fontSize: 40, color: "#a5a5a5" }} /> |
|
|
|
<FilterListIcon style={{ fontSize: 40, color: "#a5a5a5" }} /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -131,13 +112,18 @@ class Products extends Component { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export default connect((state) => ({}), { |
|
|
|
export default connect( |
|
|
|
|
|
|
|
(state) => ({ |
|
|
|
|
|
|
|
subjects: state.book.subjects, |
|
|
|
|
|
|
|
levels: state.book.levels, |
|
|
|
|
|
|
|
sortFilters: state.book.sortFilters, |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
{ |
|
|
|
searchBook: book.searchBook, |
|
|
|
searchBook: book.searchBook, |
|
|
|
filterBook: book.filterBook, |
|
|
|
filterBook: book.filterBook, |
|
|
|
})(Products); |
|
|
|
} |
|
|
|
|
|
|
|
)(Products); |
|
|
|
|
|
|
|
|
|
|
|
Products.defaultProps = { |
|
|
|
Products.defaultProps = { |
|
|
|
sortItems: ["پرفروش ترین", "جدیدترین"], |
|
|
|
sortItems: ["پرفروش ترین", "جدیدترین"], |
|
|
|
subjects: ["فیزیک", "زیست", "شیمی", "روانشناسی", "علوم", "دین و زندگی"], |
|
|
|
|
|
|
|
levels: ["اول", "دوم", "سوم", "دهم"], |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|