diff --git a/public/images/SelectCheckboxarrow-top.png b/public/images/SelectCheckboxarrow-top.png new file mode 100644 index 0000000..1b296a6 Binary files /dev/null and b/public/images/SelectCheckboxarrow-top.png differ diff --git a/src/components/SelectBox/SelectCheckbox/index.js b/src/components/SelectBox/SelectCheckbox/index.js new file mode 100644 index 0000000..02c3402 --- /dev/null +++ b/src/components/SelectBox/SelectCheckbox/index.js @@ -0,0 +1,121 @@ +import React, { useState } from "react"; +import _ from "lodash"; +import Checkbox from "../../Checkbox"; + +const langDetector = (lang, option1, option2) => { + return lang === "fa" ? option1 : option2; +}; + +export default function SelectCheckbox(props) { + const [selectedItem, setSelectedItem] = useState(""); + const [value, setValue] = useState(""); + + const [toggle, setToggle] = useState(false); + const { lang, theme, list, label, arrowIcon } = props; + + const onChangeItem = (val) => { + setSelectedItem(val); + }; + + const onChangeText = (val) => { + setValue(val); + }; + + return ( +
+
setToggle(() => !toggle)} + > + onChangeText(e.target.value)} + placeholder={langDetector(lang, "تنظیمات", "setting")} + disabled + /> + +
+ {toggle && ( +
+ +
+ )} +
+ ); +} + +SelectCheckbox.defaultProps = { + lang: "fa", + theme: "light", + label: "کشور خود را انتخاب کنید", + arrowIcon: "images/arrow-top.png", + + list: [ + { name: "وسایل آشپزخانه", sublist: [{ name: "اتو" }] }, + { name: "غریق نجات از تمام جهات" }, + { name: "قاشق و چنگال" }, + { name: "وسایل آشپزخانه" }, + ], +}; diff --git a/src/components/SelectBox/index.js b/src/components/SelectBox/index.js new file mode 100644 index 0000000..17828fc --- /dev/null +++ b/src/components/SelectBox/index.js @@ -0,0 +1,25 @@ +import React, { useState } from "react"; + +import SelectCheckbox from "./SelectCheckbox"; + +function Advertisements() { + const list = { + 1: , + }; + const [type, setType] = useState(1); + return ( +
+ + {list[type]} +
+ ); +} + +export default Advertisements; diff --git a/src/redux/data.js b/src/redux/data.js index 3bfd06a..e92aaf8 100644 --- a/src/redux/data.js +++ b/src/redux/data.js @@ -32,6 +32,7 @@ import RadioButton from "../components/RadioButton"; import Range from "../components/Range"; import Datepicker from "../components/Datepicker"; import SearchWithSuggestion from "../components/SearchWithSuggestion"; +import SelectBox from "../components/SelectBox"; // mini components import MiniComponents from "../components/MiniComponents"; @@ -665,6 +666,16 @@ const components = [ code: null, }, }, + { + name: "Select Box", + author: "Ashrafi", + props: [], + content: { + name: "Select Box", + component: , + code: null, + }, + }, // mini components { name: "Mini Components",