diff --git a/src/components/ProductFilter/VerticalExpandableProductFilter/arrow-top.png b/src/components/ProductFilter/VerticalExpandableProductFilter/arrow-top.png new file mode 100644 index 0000000..1b296a6 Binary files /dev/null and b/src/components/ProductFilter/VerticalExpandableProductFilter/arrow-top.png differ diff --git a/src/components/ProductFilter/VerticalExpandableProductFilter/index.js b/src/components/ProductFilter/VerticalExpandableProductFilter/index.js new file mode 100644 index 0000000..c440406 --- /dev/null +++ b/src/components/ProductFilter/VerticalExpandableProductFilter/index.js @@ -0,0 +1,171 @@ +import React, { useState, useEffect } from "react"; +import _ from "lodash"; + +import Checkbox from "../../Checkbox"; + +import arrowIcon from "./arrow-top.png"; +import searchIcon from "./search.png"; + +const langDetector = (lang = "fa", option1, option2) => { + return lang === "fa" ? option1 : option2; +}; + +export default function VerticalExpandableProductFilter(props) { + const [text, setText] = useState(""); + const [searchResult, setSearchResult] = useState([]); + useEffect(() => { + let fakeSearchResult; + fakeSearchResult = props.list.filter( + (item1) => item1.name.indexOf(text) !== -1 + ); + setSearchResult(fakeSearchResult); + }, [text]); + + return ( +
+ + دسته بندی + +
+ setText(e.target.value)} + /> + + + +
+ +
+ ); +} + +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: [], + }, + ], +}; diff --git a/src/components/ProductFilter/VerticalExpandableProductFilter/search.png b/src/components/ProductFilter/VerticalExpandableProductFilter/search.png new file mode 100644 index 0000000..81d586c Binary files /dev/null and b/src/components/ProductFilter/VerticalExpandableProductFilter/search.png differ diff --git a/src/components/ProductFilter/index.js b/src/components/ProductFilter/index.js new file mode 100644 index 0000000..e7aa5bf --- /dev/null +++ b/src/components/ProductFilter/index.js @@ -0,0 +1,25 @@ +import React, { useState } from "react"; + +import VerticalExpandableProductFilter from "./VerticalExpandableProductFilter"; + +function ProductFilter() { + const list = { + 1: , + }; + const [type, setType] = useState(1); + return ( +
+ + {list[type]} +
+ ); +} + +export default ProductFilter; diff --git a/src/redux/data.js b/src/redux/data.js index 24fa7b2..7d9a3e8 100644 --- a/src/redux/data.js +++ b/src/redux/data.js @@ -13,6 +13,7 @@ import Checkbox from "../components/Checkbox"; import CommentDesign from "../components/CommentDesign"; import CounterDesign from "../components/CounterDesign"; import CourseList from "../components/CourseList"; +import ProductFilter from "../components/ProductFilter"; // mini components import MiniComponents from "../components/MiniComponents"; @@ -257,6 +258,16 @@ const components = [ code: null, }, }, + { + name: "Product Filter", + author: "Ashrafi", + props: [], + content: { + name: "Product Filter", + component: , + code: null, + }, + }, // mini components { name: "Mini Components",