reza updated some feature

temp
Reza_ashrafi 3 years ago
parent 4523580573
commit 83415ba2d9
  1. 7
      src/components/Navbar/SearchResult/index.js
  2. 4
      src/components/Navbar/index.js
  3. 28
      src/components/OverLayer/index.js
  4. 65
      src/components/Product/index.js
  5. 20
      src/components/Search/index.js
  6. 141
      src/components/VerticalExpandableProductFilter/index.js
  7. 36
      src/components/VodProduct/index.js
  8. 2
      src/redux/actions/public.js
  9. 3
      src/redux/reducers/public.js
  10. 11
      src/router.js
  11. 2
      src/utils/comments.js
  12. 0
      src/utils/filter.js
  13. 4
      src/views/Home/Desktop/Part2/index.js
  14. 2
      src/views/Home/Desktop/Part4/index.js
  15. 4
      src/views/Home/Desktop/SalesContainer/index.js
  16. 3
      src/views/Products/index.js
  17. 142
      src/views/Products/layouts/Main.js
  18. 84
      src/views/Products/layouts/Sidebar.js

@ -38,12 +38,11 @@ export const SearchResult = ({ text, books, setText }) => {
return (
<div
className="w-full list-none relative"
// style={{ height: 300 }}
className="w-full list-none relative z-50"
>
<div
onClick={(e) => e.stopPropagation()}
className="absolute -top-1 w-full left-0 px-6 pt-5 bg-white pb-5 shadow-lg rounded-md flex flex-col overflow-y-scroll"
className="absolute -top-1 w-full left-0 px-6 pt-5 bg-white pb-5 shadow-lg rounded-md flex flex-col overflow-y-scroll z-50"
style={{ maxHeight: "calc(100vh / 1.5)", direction : 'ltr' }}
>
<header className="w-full flex flex-row-reverse items-center gap-4">
@ -98,7 +97,7 @@ export const SearchResult = ({ text, books, setText }) => {
</Link>
))}
</ul>
) : <span style={{direction: "rtl"}} className="text-blueC0 text-sm text-right py-4 font-semibold">هیچ محصولی یافت نشد.</span>}
) : <span style={{direction: "rtl"}} className="text-blueC0 text-sm text-right py-4 font-semibold">هیچ صفحه ای موجود نیست</span>}
</div>
</div>
);

@ -6,6 +6,7 @@ import _ from "lodash";
import Drawer from "../Drawer";
import Search from "../Search";
import SearchResult from "./SearchResult";
import OverLayer from "../OverLayer";
//assets
import cartIcon from "./cart-blue.svg";
// import whiteCartIcon from "./white-cart-icon.svg";
@ -242,8 +243,9 @@ function Navbar({
className="hidden lg:flex items-center w-3/5 justify-around flex-1 absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2"
style={{ maxWidth: "calc(100vw / 2)" }}
></div>
<OverLayer />
<div
className="flex flex-col w-full absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2"
className="flex flex-col w-full absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 z-50 rounded-md"
style={{ maxWidth: "calc(100vw / 3)" }}
>
<Search onChange={(val) => setSearch(val)} />

@ -0,0 +1,28 @@
import React from "react";
import { connect } from "react-redux";
import { publicApi } from "../../redux/actions";
export const OverLayer = ({ setOverLayer, overLayer }) => {
const click = (e) => {
setOverLayer(false);
e.stopPropagation();
};
return (
overLayer && (
<div
className="z-20 w-screen h-full fixed top-0 right-0 backdrop-filter blur-sm bg-opacity-60 bg-gray-600"
onClick={(e) => click(e)}
></div>
)
);
};
const mapStateToProps = (state) => ({
overLayer: state.publicApi.overLayer,
});
const mapDispatchToProps = {
setOverLayer: publicApi.setOverLayer,
};
export default connect(mapStateToProps, mapDispatchToProps)(OverLayer);

@ -1,5 +1,5 @@
import React, { useState } from "react";
import {connect} from 'react-redux';
import { connect } from "react-redux";
import StarRating from "../StarRating";
// import Tag from "../Tag";
@ -46,14 +46,15 @@ const ProductDesign = ({
productHolderHoverBorder,
hoverMode,
starRate,
imageSize
}) => {
const [isHovering, setIsHovering] = useState(false);
return (
<div
className={`flex flex-wrap sm:flex-nowrap justify-around`}
style={{ direction : 'rtl' }}
style={{ direction: "rtl" }}
>
<div className="w-full flex flex-wrap items-center justify-around my-5 px-4">
<div className="w-full flex flex-wrap items-center justify-around px-4">
<div
className={`w-full sm:w-60 md:w-72 rounded-lg transition-all p-2 my-3 ${productHolderBorder} ${
hoverMode == "blue" ? "hover:bg-grayF4" : null
@ -85,56 +86,26 @@ const ProductDesign = ({
</div>
{/* img */}
<div
className={`w-full flex bg-grayF4 p-0 justify-center rounded-lg`}
className={`w-11/12 flex bg-grayF4 p-0 justify-center rounded-lg`}
>
{verticalImg && (
<img
src={`https://dnvn.ir/api/v1/file/${product.fileIds}`}
alt=""
className="rounded-lg cursor-pointer py-5"
style={{height : 'calc(100vw / 5.1)', width : 'calc(100% - 75px)'}}
style={{
height: `calc(100vh / ${imageSize})`,
width: `calc(100vh / ${imageSize} * 2 / 3.5)`,
}}
/>
)}
</div>
{/* select Color */}
{/* {colors && (
<div className="flex items-center absolute right-2 bottom-2">
<img
src={YellowDotIcon}
alt=""
data-tip="زرد"
className="w-3 h-3 ml-1 cursor-pointer"
/>
<ReactTooltip place="top" type="dark" effect="float" />
<img
src={RedDotIcon}
alt=""
data-tip="قرمز"
className="w-3 h-3 ml-1 cursor-pointer"
/>
<ReactTooltip place="top" type="dark" effect="float" />
<img
src={PurpleDotIcon}
alt=""
data-tip="بنفش"
className="w-3 h-3 ml-1 cursor-pointer"
/>
<ReactTooltip place="top" type="dark" effect="float" />
<img
src={LightBlueDotIcon}
alt=""
data-tip="آبی"
className="w-3 h-3 ml-1 cursor-pointer"
/>
<ReactTooltip place="top" type="dark" effect="float" />
</div>
)} */}
</div>
{/* product content */}
<div className="px-2">
<div className="mt-4">
<h2
className={`leading-4 text-xl font-black py-2 ${productTitleColor} ${productTitleAlignment}`}
className={`leading-5 text-base 2xl:text-tiny font-normal py-2 text-right ${productTitleColor}`}
>
{product?.product[1]?.name}
</h2>
@ -148,9 +119,9 @@ const ProductDesign = ({
)}
{productCat && (
<span
className={`text-md py-1 font-light ${productCatTextColor}`}
className={`text-sm py-1 font-normal ${productCatTextColor}`}
>
{grades[product.gradeId]}
{"پایه" + " " + grades[product.gradeId]}
</span>
)}
</div>
@ -158,15 +129,15 @@ const ProductDesign = ({
{star && (
<div className="flex items-center mt-3">
<StarRating value={starRate} />
<span className="text-xs text-productContent font-bold text-gray-500 mr-2">
{/* <span className="text-xs text-productContent font-bold text-gray-500 mr-2">
بر اساس {numberOfRegards} بررسی
</span>
</span> */}
</div>
)}
{/* price */}
{priceHolder && (
<div
className={`flex items-center justify-between ${priceDirection}`}
className={`flex items-center justify-between mt-2 ${priceDirection}`}
>
<div className="mt-2">
<div
@ -186,7 +157,7 @@ const ProductDesign = ({
</p>
)}
</div>
<p className="text-xl text-productPrice font-semibold inline text-blue5F">
<p className="text-lg text-productPrice font-semibold inline text-blue5F">
{product?.product[1]?.price} <span>تومان</span>
</p>
</div>
@ -237,8 +208,8 @@ const ProductDesign = ({
};
const mapStateToProps = (state) => ({
grades : state.publicApi.grades,
})
grades: state.publicApi.grades,
});
export default connect(mapStateToProps)(ProductDesign);

@ -1,4 +1,6 @@
import React from "react";
import {connect} from 'react-redux';
import { publicApi } from "../../redux/actions";
import _ from "lodash";
import searchIcon from "./search.png";
@ -6,9 +8,9 @@ const langDetector = (lang = 'fa', option1, option2) => {
return lang === "fa" ? option1 : option2;
};
export default function Search(props) {
function Search(props) {
return (
<div className="flex items-center justify-center w-full my-3">
<div className="flex items-center justify-center w-full my-3 bg-white z-50 overflow-hidden rounded-md">
<div className="relative text-gray-600 focus-within:text-gray-400 w-full">
<span className={_.join(["absolute inset-y-0 flex items-center pl-2", langDetector(props.lang, "left-0", "right-0")], " ")}>
<button
@ -21,12 +23,24 @@ export default function Search(props) {
<input
type="search"
name={props.name}
className="w-full py-3 text-sm lg:text-tiny lg:font-semibold text-gray1 border border-solid border-gray-200 rounded-md pr-5 pl-14 outline-none focus:ring-1 focus:text-gray-900 "
className="z-50 w-full py-3 text-sm lg:text-tiny lg:font-semibold text-gray1 border border-solid border-gray-200 rounded-md pr-5 pl-14 outline-none focus:ring-1 focus:text-gray-900 "
placeholder={_.join([langDetector(props.lang , "جستجو...", "Search...")], " ")}
autoComplete="off"
onChange={(e) => props.onChange(e.target.value)}
onFocus={() => props.setOverLayer(true)}
onBlur={() => props.setOverLayer(false)}
/>
</div>
</div>
);
}
const mapStateToProps = (state) => ({
})
const mapDispatchToProps = {
setOverLayer : publicApi.setOverLayer
}
export default connect(mapStateToProps, mapDispatchToProps)(Search);

@ -12,21 +12,22 @@ export default function VerticalExpandableProductFilter(props) {
const [text, setText] = useState("");
const [searchResult, setSearchResult] = useState([]);
const [checkedBox, setChecked] = useState([]);
const name = props.name||Math.random()
useEffect(() => {
let fakeSearchResult;
fakeSearchResult = props.list.filter(
(item1) => item1.name.indexOf(text) !== -1
);
setSearchResult(fakeSearchResult);
}, [text]);
const name = props.name || Math.random();
// useEffect(() => {
// let fakeSearchResult;
// fakeSearchResult = props.list.filter(
// (item1) => item1.name.indexOf(text) !== -1
// );
// setSearchResult(fakeSearchResult);
// }, [text]);
return (
<div className="flex flex-col w-full border border-solid border-gray-100 rounded-md pt-6 bg-transparent max-h-screen bg-white my-3">
<strong className="text-md text-gray-500 w-full mb-3 text-right px-3">
{props.title}
</strong>
{props.searchAble && <form className="relative w-full px-3 mb-3">
{props.searchAble && (
<form className="relative w-full px-3 mb-3">
<input
type="text"
placeholder={_.join(
@ -52,29 +53,34 @@ export default function VerticalExpandableProductFilter(props) {
<img src={searchIcon} className="w-5 h-5" alt="" />
</button>
</span>
</form>}
<ul className="w-full list-none flex flex-col divide-y divide-gray-100">
</form>
)}
<ul className="w-full list-none flex flex-col divide-y divide-gray-100 overflow-y-scroll" style={{maxHeight: 'calc(100vh / 3.5)', minHeight: 200}}>
{(searchResult.length > 0 ? searchResult : props.list)?.map(
(item1, i) => (
<li
key={i}
className="hover:bg-gray-100 px-3 flex flex-row items-center justify-between py-2"
>
{/* {console.log(i)} */}
<div className="flex flex-row items-center">
<Checkbox name={`ch${name}_${i}`} checked={checkedBox[i]} onclick={(e) => {
checkedBox[i] = !checkedBox[i]
setChecked(checkedBox)
}} onChange={() => props.onChange(name , item1.name)} />
<Checkbox
name={`ch${name}_${i}`}
checked={false}
onclick={(e) => {
checkedBox[i] = !checkedBox[i];
setChecked(checkedBox);
}}
onChange={() => props.onChange(name, item1.name)}
/>
<strong className="text-xs font-light text-gray-500">
{props.preName ? props.preName + ' ' + item1.name : item1.name}
{props.preName
? props.preName + " " + item1.name
: item1}
</strong>
</div>
{item1.subList?.length > 0 && (
{item1?.subList?.length > 0 && (
<img
src={arrowIcon}
alt=""
@ -91,92 +97,17 @@ export default function VerticalExpandableProductFilter(props) {
)
)}
</ul>
{props.btnTitle && <div className="flex align-center justify-center">
<button className="my-4 bg-blueFFOP text-sm bg-opacity-40 transition-all w-4/5 py-3 px-6 rounded text-blueC0 hover:text-white hover:bg-blueC0" onClick={props.btnClicked}>{props.btnTitle}</button>
</div>}
{props.btnTitle && (
<div className="flex align-center justify-center">
<button
className="my-4 bg-blueFFOP text-sm bg-opacity-40 transition-all w-4/5 py-3 px-6 rounded text-blueC0 hover:text-white hover:bg-blueC0"
onClick={props.btnClicked}
>
{props.btnTitle}
</button>
</div>
)}
</div>
);
}
VerticalExpandableProductFilter.defaultProps = {
list: [
{
id: 0,
name: "وسایل آشپزخانه",
expaneded: false,
subList: [],
},
{
id: 3,
name: "ماشین و موتور سیکلت",
expaneded: false,
subList: [
{
id: 4,
name: "ماشین",
},
{
id: 5,
name: "موتور",
},
],
},
{
id: 6,
name: "اتاق خواب",
expaneded: false,
subList: [
{
id: 7,
name: "کمد",
},
{
id: 8,
name: "تخت خواب",
},
],
},
{
id: 9,
name: "دکوراسیون و چیدمان",
expaneded: false,
subList: [],
},
{
id: 10,
name: "وسایل بهداشت شخصی",
expaneded: false,
subList: [
{
id: 11,
name: "مسواک",
},
{
id: 12,
name: "حوله",
},
],
},
{
id: 13,
name: "وسایل بهداشت شخصی",
expaneded: false,
subList: [
{
id: 14,
name: "مسواک",
},
{
id: 15,
name: "حوله",
},
],
},
{
id: 16,
name: "وسایل بهداشت شخصی",
expaneded: false,
subList: [],
},
],
};

@ -4,13 +4,12 @@ import StarRating from "../StarRating";
import ReactTooltip from "react-tooltip";
//assets
import videoImage1 from './videoImages/image-1.svg';
import videoImage2 from './videoImages/image-2.svg';
import videoImage3 from './videoImages/image-3.svg';
import videoImage4 from './videoImages/image-4.svg';
import videoImage5 from './videoImages/image-5.svg';
import videoImage6 from './videoImages/image-6.svg';
import videoImage1 from "./videoImages/image-1.svg";
import videoImage2 from "./videoImages/image-2.svg";
import videoImage3 from "./videoImages/image-3.svg";
import videoImage4 from "./videoImages/image-4.svg";
import videoImage5 from "./videoImages/image-5.svg";
import videoImage6 from "./videoImages/image-6.svg";
import watermelon from "./watermelon.png";
import video from "./danovin.mp4";
@ -22,7 +21,14 @@ import PurpleDotIcon from "./purpleDotIcon.svg";
import LightBlueDotIcon from "./lightBlueDotIcon.svg";
import whitePlayIcon from "./white-play-button-icon.svg";
const videoImages = [videoImage1, videoImage2, videoImage3, videoImage4,videoImage5, videoImage6];
const videoImages = [
videoImage1,
videoImage2,
videoImage3,
videoImage4,
videoImage5,
videoImage6,
];
const VodProduct = ({
index,
@ -50,7 +56,8 @@ const VodProduct = ({
productTitle,
poster,
price,
minHeight
height,
// minHeight,
}) => {
const [progressFlag, setProgressFlag] = useState(false);
// const [openModal, setOpenModal] = useState(false);
@ -64,8 +71,8 @@ const VodProduct = ({
return (
<>
{/* product UI Design */}
<div className="flex flex-wrap sm:flex-nowrap justify-around">
<div className="w-full flex flex-wrap items-center justify-around my-10 px-1 sm:px-4">
<div className="flex flex-wrap sm:flex-nowrap justify-around" style={{direction: 'rtl'}}>
<div className="w-full flex flex-wrap items-center justify-around my-3 px-1 sm:px-4">
<div
className={`w-full mx-1 sm:w-60 md:w-96 rounded-lg shadow-sm p-2 my-3 border border-grayBorderColor`}
>
@ -76,12 +83,13 @@ const VodProduct = ({
backgroundImage: `url(${videoImages[Number(index)]})`,
backgroundSize: "100% 100%",
backgroundRepeat: "no-repeat",
minHeight: minHeight,
height : height
// minHeight: minHeight,
}}
data-modal-toggle="large-modal"
>
{/* icons on image */}
<div className="absolute left-6 top-2">
<div className="absolute left-2 top-1">
{discountPricePercent && (
<div className="bg-discountPriceBg rounded-md px-2 py-2 mt-2 transition ease-in-out duration-300 transform hover:-translate-y-1 hover:scale-110 cursor-pointer bg-white bg-opacity-70">
<p className="text-discountPriceTitle font-bold text-xs">
@ -114,7 +122,7 @@ const VodProduct = ({
</div>
{/* select Color */}
{productColor && (
<div className="flex items-center absolute right-6 bottom-2">
<div className="flex items-center absolute right-2 bottom-3">
{/* {colors.map((color,index))} */}
<img
src={YellowDotIcon}

@ -1,5 +1,7 @@
import proxy from "../proxy";
const publicApi = {
setOverLayer: (data) => async (dispatch) =>
await dispatch({ type: "public/setOverLayer", data }),
setDesktopContentTransform: (data) => async (dispatch) =>
await dispatch({ type: "public/setDesktopContentTransform", data }),
setHeaderOptions: (data) => async (dispatch) =>

@ -61,6 +61,7 @@ const initialState = {
title: false,
},
desktopContentTransform: false,
overLayer: false,
};
const grades = [
@ -82,6 +83,8 @@ const grades = [
export default function publicApi(state = initialState, action) {
let { type, data } = action;
switch (type) {
case "public/setOverLayer":
return { ...state, overLayer: data };
case "public/setDesktopContentTransform":
return { ...state, desktopContentTransform: data };
case "public/setHeaderOptions":

@ -27,7 +27,7 @@ import Faq from "./views/Faq";
import Contact from "./views/Contact";
import Dashboard from "./views/Dashboard";
import FooterDesign1 from "./components/Footer";
import Bugs from './views/BugsAndProblems';
import Bugs from "./views/BugsAndProblems";
// import VideoTube from "./views/Home/VideoTube";
function Router({
@ -352,14 +352,7 @@ function Router({
/>
}
/>
<Route
path="/bugs"
exact
element={
<Bugs
/>
}
/>
<Route path="/bugs" exact element={<Bugs />} />
<Route
path="*"
exact

@ -1,3 +1,5 @@
export const connectToParent = (list) => {
let comments = [];
for (let item of list) {

@ -51,7 +51,7 @@ const Part2 = ({ books, grades }) => {
{books.length > 0 && (
<div className="relative w-full" style={{ direction: "ltr" }}>
<Carousel
show={4.5}
show={Math.round(window.innerWidth / 350)}
slide={2}
swiping={true}
useArrowKeys={true}
@ -72,7 +72,7 @@ const Part2 = ({ books, grades }) => {
}
>
{books.map((product, index) => (
<Product key={index} product={product} />
<Product key={index} product={product} imageSize={3} />
))}
</Carousel>
</div>

@ -102,7 +102,7 @@ const Part4 = () => {
discountPrice={false}
key={index}
index={index}
minHeight={"calc(100vh / 3.5)"}
height={"calc(100vh / 3.8)"}
/>
</Link>
</li>

@ -40,7 +40,7 @@ const SalesContainer = ({ books }) => {
{books.length > 0 && (
<div className="relative w-full" style={{ direction: "ltr" }}>
<Carousel
show={window.innerWidth / 350}
show={Math.round(window.innerWidth / 350)}
slide={2}
swiping={true}
useArrowKeys={true}
@ -63,7 +63,7 @@ const SalesContainer = ({ books }) => {
}
>
{books.map((product, index) => (
<Product key={index} product={product} />
<Product key={index} product={product} imageSize={3} />
))}
</Carousel>
</div>

@ -162,9 +162,8 @@ export const Products = ({
) : (
<div
className={`w-full flex flex-row gap-10 px-5 overflow-y-hidden mt-3 justify-center`}
// style={{ height: 1500 }}
>
<div className="w-11/12 flex">
<div className="w-11/12 flex flex-row gap-5">
<Sidebar onChange={onChange}/>
<Main filter={filter}/>
</div>

@ -1,18 +1,17 @@
import React, { useState, useEffect, useCallback } from "react";
import ScrollContainer from "react-indiana-drag-scroll";
import { connect } from 'react-redux';
import { connect } from "react-redux";
import { Link } from "react-router-dom";
import filterIcon from '../../../assets/images/vuesax-linear-filter-tick.svg';
import { Carousel } from "@trendyol-js/react-carousel";
import Product from '../../../components/Product'
import filterIcon from "../../../assets/images/vuesax-linear-filter-tick.svg";
import Product from "../../../components/Product";
import VodProduct from "../../../components/VodProduct";
import { book, publicApi } from "../../../redux/actions";
import posterImage from "../../../assets/images/poster.svg";
import arrow from "../../../assets/icons/slider-arrow.svg";
export const Main = ({ isMobile,
export const Main = ({
books,
getList,
grades,
gradeFilter,
selectedGrade,
@ -20,28 +19,30 @@ export const Main = ({ isMobile,
setHeaderOptions,
headerOptions,
videos,
filter }) => {
filter,
}) => {
useEffect(() => {
window.scrollTo(0, 0)
}, [])
window.scrollTo(0, 0);
}, []);
const filteringNavItems = [
{
title: 'بیشترین بازدید'
title: "بیشترین بازدید",
},
{
title: 'پرفروش ترین'
title: "پرفروش ترین",
},
{
title: 'کمترین قیمت'
title: "کمترین قیمت",
},
{
title: 'بیشترین قیمت'
title: "بیشترین قیمت",
},
{
title: 'محبوب ترین'
title: "محبوب ترین",
},
];
const videosData = [
{
id: 0,
@ -82,33 +83,51 @@ export const Main = ({ isMobile,
grade: "پایه چهارم",
imageUrl: "https://dnvn.ir/api/v1/file/2105",
poster: posterImage,
}
]
return <div className="flex flex-col w-3/4 p-4">
},
];
return (
<div className="flex flex-col w-3/4 p-4 pb-20">
<div className="flex w-full bg-blue rounded-lg border border-solid border-gray-200 p-2 items-center my-1.5 justify-center text-blue52">
<div className='flex text-xs items-center mx-4'>
<div className="flex text-xs items-center mx-4">
<img src={filterIcon} />
<span>
مرتب سازی بر اساس
</span>
<span>مرتب سازی بر اساس</span>
</div>
<ul className='flex justify-between w-3/4 px-4 py-0 '>
{
filteringNavItems.map(e => (
<li className='text-sm rounded py-2 px-6 transition-all duration-700 hover:bg-gray-300 hover:text-blueC0 cursor-pointer' onClick={() => console.log('a')}>{e.title}</li>
))
}
<ul className="flex justify-between w-3/4 px-4 py-0 ">
{filteringNavItems.map((e) => (
<li
className="text-sm rounded py-2 px-6 transition-all duration-700 hover:bg-gray-300 hover:text-blueC0 cursor-pointer"
onClick={() => console.log("a")}
>
{e.title}
</li>
))}
</ul>
</div>
<ScrollContainer className="flex">
{
videosData.map((video, index) => (
<Link
to={"/videos/" + video.id}
className="flex flex-col rounded-md ml-4 "
<div className="relative w-full" style={{ direction: "ltr" }}>
<Carousel
show={Math.round(window.innerWidth / 500)}
slide={2}
swiping={true}
useArrowKeys={true}
transition={0.5}
className="flex flex-row"
rightArrow={
<img
className="absolute top-1/2 transform -translate-y-1/2 cursor-pointer p-2"
src={arrow}
alt=""
/>
}
leftArrow={
<img
className="absolute top-1/2 transform -translate-y-1/2 -translate-x-5 cursor-pointer -rotate-180 p-2"
src={arrow}
alt=""
/>
}
>
{videosData.map((video, index) => (
<VodProduct
productTitle={`دوره ی ویدیویی ${video.name}`}
productCat={video.grade}
@ -117,15 +136,13 @@ export const Main = ({ isMobile,
discountPrice={false}
key={index}
index={index}
minHeight={"250px"}
height={"calc(100vh / 5)"}
/>
</Link>
))
}
</ScrollContainer>
))}
</Carousel>
</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-evenly">
{selectedGrade
? gradeFilterBooks?.map((product, index) => (
<Product
@ -139,51 +156,40 @@ export const Main = ({ isMobile,
productPrice={100000}
productImg={"https://dnvn.ir/api/v1/file/" + product?.fileIds}
numberOfRegards={160}
productTitleColor='text-blue5F'
productCatTextColor='text-blueC0'
productHolderBorder=''
productHolderHoverBorder='shadow-md'
productTitleColor="text-blue5F"
productCatTextColor="text-blueC0"
productHolderBorder=""
productHolderHoverBorder="shadow-md"
starRate={Math.floor(Math.random() * 5) + 1}
imageSize={4.5}
/>
))
: books?.map((product, index) => (
<Link to={"/products/" + product?.id}>
<Link
to={"/products/" + product?.id}
className="w-full lg:w-1/3 xl:w-1/4 2xl:w-1/5"
>
<Product
key={index}
productsType={filter.productsType}
product={product}
index={Number(index)}
productName={`کتاب ${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'
starRate={Math.floor(Math.random() * 5) + 2}
imageSize={4.5}
/>
</Link>
))}
</div>
</div>;
</div>
);
};
Main.defaultProps ={
videos: [
]
}
Main.defaultProps = {
videos: [],
};
const mapStateToProps = (state) => ({
isDark: state.publicApi.isDark,
isMobile: state.publicApi.isMobile,
books: state.book.list,
grades: state.publicApi.grades,
gradeFilterBooks: state.book.gradeFilterBooks,
selectedGrade: state.book.selectedGrade,
});
const mapDispatchToProps = {

@ -3,69 +3,33 @@ import { connect } from "react-redux";
import Checkbox from "../../../components/Checkbox";
import VerticalExpandableProductFilter from "../../../components/VerticalExpandableProductFilter";
export const Sidebar = ({onChange}) => {
const filteronGrade = [
{
id:0,
name: "اول",
expaneded: false,
subList: [{
id:1,
name: 'علوم اجتماعی'
}],
},
{
id:1,
name: "دوم",
expaneded: false,
subList: [{
id:1,
name: 'علوم اجتماعی'
}],
},
{
id:2,
name: "سوم",
expaneded: false,
subList: [],
},
];
export const Sidebar = ({ onChange, grades }) => {
const categories = [
{
id: 0,
expaneded: false,
name: 'کتاب فیزیکی',
subList: []
},
{
id: 1,
expaneded: false,
name: 'کتاب دیجیتال',
subList: []
},
{
id: 2,
expaneded: false,
name: 'دوره ویدیویی',
subList: []
},
{
id: 3,
expaneded: false,
name: 'بسته های آموزشی',
subList: []
},
]
return <div className="flex flex-col w-1/4 p-4">
<VerticalExpandableProductFilter onChange={onChange} name="grade" preName='پایه' btnTitle='مشاهده همه ی کالاهای آموزشی' list={filteronGrade} title="پایه تحصیلی" searchAble={true}/>
<VerticalExpandableProductFilter name="category" list={categories} title="دسته بندی" searchAble={false}/>
</div>;
"کتاب فیزیکی",
"کتاب دیجیتال",
"دوره ویدیویی",
"بسته های آموزشی",
];
return (
<div className="flex flex-col w-1/4 p-4">
<VerticalExpandableProductFilter
onChange={onChange}
name="grade"
list={Object.values(grades)}
title="پایه تحصیلی"
/>
<VerticalExpandableProductFilter
name="category"
list={categories}
title="دسته بندی"
/>
</div>
);
};
const mapStateToProps = (state) => ({});
const mapStateToProps = (state) => ({
grades: state.publicApi.grades,
});
const mapDispatchToProps = {};

Loading…
Cancel
Save