From 0e6c073a9924f5c91aa899ed1cd3a81ab8316f52 Mon Sep 17 00:00:00 2001 From: Reza_ashrafi Date: Mon, 11 Jul 2022 19:39:17 +0430 Subject: [PATCH] update 3 files and delete 1 file --- src/components/Input/index.js | 149 +------------------ src/components/Input/index.scss | 60 -------- src/views/Auth/Profile/GenderSwitch/index.js | 29 ++-- src/views/Auth/Profile/index.js | 4 +- 4 files changed, 25 insertions(+), 217 deletions(-) delete mode 100644 src/components/Input/index.scss diff --git a/src/components/Input/index.js b/src/components/Input/index.js index 3bc5934..fdaa69e 100644 --- a/src/components/Input/index.js +++ b/src/components/Input/index.js @@ -1,39 +1,13 @@ import React, { useState } from "react"; import _ from "lodash"; -import "./index.scss"; - -const langDetector = (lang, option1, option2) => { - return lang === "fa" ? option1 : option2; -}; - -const inputStatusHandler = (value, focus, status, primary, success, danger) => { - if (!focus) { - return ""; - } else { - if (!value) { - return primary; - } else { - if (status) { - return success; - } else { - return; - } - } - } -}; export default function Input(props) { const [focusToggle, setFocusToggle] = useState(false); const { - backgroundColor, - lang, - theme, inputMode, label, - status, maxLength, - message, onChange, align, name, @@ -45,136 +19,27 @@ export default function Input(props) { return (
- {/* onChange(name, (e.target.value = regex(e.target.value))) } onFocus={() => setFocusToggle(true)} - onBlur={() => (!value ? setFocusToggle(false) : setFocusToggle(true))} + onBlur={() => setFocusToggle(false)} maxLength={maxLength} /> - {/* {!status && value && ( - {langDetector(lang, - )} */} - {/* {status && value && ( - {langDetector(lang, - )} */} - - {value && !status && ( - - {message} - - )} - {/* {value && ( - - {value.length + "/" + maxLength} - - )} */}
); } diff --git a/src/components/Input/index.scss b/src/components/Input/index.scss deleted file mode 100644 index 1f05250..0000000 --- a/src/components/Input/index.scss +++ /dev/null @@ -1,60 +0,0 @@ -$primary: #23C933; -$gray: #dbdbdb; -$danger: #E00A0A; -$success: #23C933; - -.input { - &__labelFocus{ - top: 0px !important; - font-size: 9px !important; - color: $primary !important; - } - &__labelDanger{ - top: 0px !important; - font-size: 9px !important; - color: $danger !important; - } - &__labelSuccess{ - top: 0px !important; - font-size: 9px !important; - color: $success !important; - } - - - &__inputActive{ - border-color: $primary !important; - } - &__inputSuccess{ - border-color: $success !important; - } - &__inputDanger{ - border-color: $danger !important; - } - - &__message{ - &Success{ - color: $success; - } - &Danger{ - color: $danger; - } - } - &__length{ - &Success{ - color: $success; - } - &Danger{ - color: $danger; - } - } -} - -.en { - direction: ltr; - text-align: left; -} - -.fa { - direction: rtl; - text-align: right; -} \ No newline at end of file diff --git a/src/views/Auth/Profile/GenderSwitch/index.js b/src/views/Auth/Profile/GenderSwitch/index.js index 3985450..124c6c4 100644 --- a/src/views/Auth/Profile/GenderSwitch/index.js +++ b/src/views/Auth/Profile/GenderSwitch/index.js @@ -1,5 +1,5 @@ import React from "react"; -import './index.scss'; +import "./index.scss"; export default function GenderSwitch({ onChange, @@ -9,18 +9,21 @@ export default function GenderSwitch({ label, }) { return ( -
-
onChange(name, 2)} - > - {options[0]} -
-
onChange(name, 1)} - > - {options[1]} +
+ {label} +
+ {options?.map((option, index) => ( +
onChange(name, index + 1)} + > + {option} +
+ ))}
); diff --git a/src/views/Auth/Profile/index.js b/src/views/Auth/Profile/index.js index ba6c79b..bf878a1 100644 --- a/src/views/Auth/Profile/index.js +++ b/src/views/Auth/Profile/index.js @@ -472,7 +472,7 @@ function Profile({
) : (
onSubmit()} > setFormData({ ...formData, [name]: value }) } - label="" + label="جنسیت" />