From e5265fbcbabeb1fb128ee00a1f73292a779be8b6 Mon Sep 17 00:00:00 2001 From: mahdi Date: Sun, 15 May 2022 12:31:01 +0430 Subject: [PATCH] update src/components/SelectBox/index.js --- public/images/SelectRadioarrow-top.png | Bin 0 -> 229 bytes public/images/SelectRadiox.png | Bin 0 -> 346 bytes src/components/SelectBox/SelectRadio/index.js | 104 ++++++++++++++++++ src/components/SelectBox/index.js | 2 + 4 files changed, 106 insertions(+) create mode 100644 public/images/SelectRadioarrow-top.png create mode 100644 public/images/SelectRadiox.png create mode 100644 src/components/SelectBox/SelectRadio/index.js diff --git a/public/images/SelectRadioarrow-top.png b/public/images/SelectRadioarrow-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}{W&YxE9d!nhdrk`veoHDE{Q3bsNmSOfGz1 { + return lang === "fa" ? option1 : option2; +}; + +export default function SelectRadio(props) { + const [selectedItem, setSelectedItem] = useState(""); + const [value, setValue] = useState(""); + + const [toggle, setToggle] = useState(false); + const { lang, theme, list, label, xIcon, 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) => ( + <> +
  • + +
  • + + ))} +
+
+ )} +
+ ); +} + +SelectRadio.defaultProps = { + lang: "fa", + theme: "light", + xIcon: "images/SelectRadiox.png", + arrowIcon: "images/SelectRadioarrow-top.png", + + list: [ + { name: "وسایل آشپزخانه", sublist: [{ name: "اتو" }] }, + { name: "غریق نجات از تمام جهات" }, + { name: "قاشق و چنگال" }, + { name: "وسایل آشپزخانه" }, + ], +}; diff --git a/src/components/SelectBox/index.js b/src/components/SelectBox/index.js index 17828fc..a396904 100644 --- a/src/components/SelectBox/index.js +++ b/src/components/SelectBox/index.js @@ -1,10 +1,12 @@ import React, { useState } from "react"; import SelectCheckbox from "./SelectCheckbox"; +import SelectRadio from "./SelectRadio"; function Advertisements() { const list = { 1: , + 2: , }; const [type, setType] = useState(1); return (