From c5c7acb370f682f6272c395b56b0e9489aeae6c9 Mon Sep 17 00:00:00 2001 From: Pkpedram Date: Sat, 2 Apr 2022 03:41:44 +0430 Subject: [PATCH] Stepper Done --- src/components/Stepper/index.css | 9 +++++++++ src/components/Stepper/index.js | 7 ++++++- src/components/input/index.js | 2 +- src/redux/reducers/userProduct.js | 4 ++-- src/utils/separate.js | 12 ++++++++++++ src/view/contact/index.js | 20 ++++++++++++++++++-- src/view/services/index.js | 2 +- 7 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 src/components/Stepper/index.css create mode 100644 src/utils/separate.js diff --git a/src/components/Stepper/index.css b/src/components/Stepper/index.css new file mode 100644 index 0000000..ec7d422 --- /dev/null +++ b/src/components/Stepper/index.css @@ -0,0 +1,9 @@ +.giveMeEllipsis { + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; /* number of lines to show */ + /* line-height: 1; /* fallback */ + /* max-height: 1*2; fallback */ + } \ No newline at end of file diff --git a/src/components/Stepper/index.js b/src/components/Stepper/index.js index d640bb4..91d725f 100644 --- a/src/components/Stepper/index.js +++ b/src/components/Stepper/index.js @@ -1,4 +1,6 @@ import React, {useState} from "react"; +import separate from "../../utils/separate"; +import './index.css' function Stepper({ direction, @@ -39,7 +41,10 @@ function Stepper({ : null } -

{item.title}

+
+

{index + 1}

+

{item.title}

+
{count !== (Number(index) + 1) && ( focusHandler(id ? id : 0)} onBlur={() => blurHandler(id ? id : 0)} diff --git a/src/redux/reducers/userProduct.js b/src/redux/reducers/userProduct.js index 1434248..ad3e4db 100644 --- a/src/redux/reducers/userProduct.js +++ b/src/redux/reducers/userProduct.js @@ -33,9 +33,9 @@ export default function userFactor(state = initialState, action) { case "userProduct/update": return { ...state, loading: false, error: null }; case "userProduct/add": - if (window.location.pathname.indexOf("products") !== -1) { + toast.success("درخواست شما با موفقیت انجام شد."); - } + return { ...state, loading: false, error: null, sum: data.payPrice }; case "userProduct/delete": return { ...state, loading: false, error: null }; diff --git a/src/utils/separate.js b/src/utils/separate.js new file mode 100644 index 0000000..3ead65f --- /dev/null +++ b/src/utils/separate.js @@ -0,0 +1,12 @@ +const separate = (number) => { + number += ""; + number = number.replace(",", ""); + let x = number.split("."); + let y = x[0]; + let z = x.length > 1 ? "." + x[1] : ""; + let rgx = /(\d+)(\d{3})/; + while (rgx.test(y)) y = y.replace(rgx, "$1" + "," + "$2"); + return y + z; +}; + +export default separate; diff --git a/src/view/contact/index.js b/src/view/contact/index.js index 690b52f..ec61489 100644 --- a/src/view/contact/index.js +++ b/src/view/contact/index.js @@ -52,7 +52,15 @@ const ContactUs = ({isMobile}) => {
- + { + let value = e.target.value + + value = value.replace(/[^A-Za-z]/ig, '') + + this.setState({ + value, + }) +}}/> - + { + let value = e.target.value + + value = value.replace(/[^A-Za-z]/ig, '') + + this.setState({ + value, + }) +}} />