diff --git a/public/images/SelectRadioarrow-top.png b/public/images/SelectRadioarrow-top.png new file mode 100644 index 0000000..1b296a6 Binary files /dev/null and b/public/images/SelectRadioarrow-top.png differ diff --git a/public/images/SelectRadiox.png b/public/images/SelectRadiox.png new file mode 100644 index 0000000..df19f25 Binary files /dev/null and b/public/images/SelectRadiox.png differ diff --git a/src/components/SelectBox/SelectRadio/index.js b/src/components/SelectBox/SelectRadio/index.js new file mode 100644 index 0000000..57ea61a --- /dev/null +++ b/src/components/SelectBox/SelectRadio/index.js @@ -0,0 +1,104 @@ +import React, { useState } from "react"; +import _ from "lodash"; +import Radio from "../../RadioButton/Radio1"; + +const langDetector = (lang, option1, option2) => { + 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 && ( +
+ +
+ )} +
+ ); +} + +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 (