From a70498e49a95fc68d318258bb244f3ac1f3bcc16 Mon Sep 17 00:00:00 2001 From: mahdi Date: Sun, 15 May 2022 12:23:19 +0430 Subject: [PATCH] update data.js --- public/images/SelectCheckboxarrow-top.png | Bin 0 -> 229 bytes .../SelectBox/SelectCheckbox/index.js | 121 ++++++++++++++++++ src/components/SelectBox/index.js | 25 ++++ src/redux/data.js | 11 ++ 4 files changed, 157 insertions(+) create mode 100644 public/images/SelectCheckboxarrow-top.png create mode 100644 src/components/SelectBox/SelectCheckbox/index.js create mode 100644 src/components/SelectBox/index.js diff --git a/public/images/SelectCheckboxarrow-top.png b/public/images/SelectCheckboxarrow-top.png new file mode 100644 index 0000000000000000000000000000000000000000..1b296a6563cec4c1f9a16ad37d17d500057591f5 GIT binary patch literal 229 zcmeAS@N?(olHy`uVBq!ia0vp^f*{Pn1|+R>-G2comSQK*5Dp-y;YjHK^5=NEIEGmG zU%lkW*W|#%df~s} { + 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 && ( +
+
    + {list?.map((item, i) => ( + <> +
  • +
    + + {item?.name} +
    +
      + {item.sublist?.map((item1, j) => ( + <> +
    • + + {item1?.name} +
    • + + ))} +
    +
  • + + ))} +
+
+ )} +
+ ); +} + +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",