From 506e95e44aa0fb4b096ed1f00b0d7103463b3d93 Mon Sep 17 00:00:00 2001 From: Reza_ashrafi Date: Wed, 20 Oct 2021 12:50:20 +0330 Subject: [PATCH] reza fixed login and search box --- src/components/HomeSearchBox/index.scss | 29 +++++++++++--- src/components/HomeSearchBox/index.tsx | 39 ++++++++++--------- src/components/Navbar/index.scss | 2 +- src/components/PrivateRouter/index.js | 5 ++- src/custom.scss | 3 +- src/redux/reducers/user.tsx | 3 ++ src/router.js | 27 +++++++++---- src/views/Auth/Login/index.scss | 2 +- src/views/Auth/SignUp/index.scss | 2 +- src/views/Auth/SignUp/index.tsx | 14 ++++++- src/views/Home/Courses/index.tsx | 2 +- .../Subscription/DiscountCode/index.scss | 8 ++-- .../Subscription/SubscribeRadio/index.scss | 4 +- .../Subscription/SubscribeRadio/index.tsx | 2 +- src/views/Subscription/index.scss | 2 +- 15 files changed, 94 insertions(+), 50 deletions(-) diff --git a/src/components/HomeSearchBox/index.scss b/src/components/HomeSearchBox/index.scss index e6c2ffb..a8dd2f3 100644 --- a/src/components/HomeSearchBox/index.scss +++ b/src/components/HomeSearchBox/index.scss @@ -27,6 +27,18 @@ } } } + footer{ + ul{ + li{ + cursor: pointer; + } + } + strong{ + color: #9cdf52; + font-weight: 300; + margin-left: 20px; + } + } } @media screen and (min-width: 1441px) { @@ -39,7 +51,7 @@ } form { - width: 1000px; + width: 900px; input { font-size: 16px; padding-right: 20px; @@ -55,14 +67,19 @@ } } } - ul { - width: 1000px; + footer { + width: 900px; padding: 10px 0px !important; - li { - color: #a2b4cb; - margin-left: 25px; + strong{ font-size: 14px; } + ul{ + li { + color: #a2b4cb; + margin-left: 25px; + font-size: 14px; + } + } } } } diff --git a/src/components/HomeSearchBox/index.tsx b/src/components/HomeSearchBox/index.tsx index bd37704..41d0686 100644 --- a/src/components/HomeSearchBox/index.tsx +++ b/src/components/HomeSearchBox/index.tsx @@ -34,34 +34,39 @@ function HomeSearchBox({ type="submit" onClick={() => sortFilter({ search: inputValue, sort: selectedSort })} > - + sortFilter({ search: inputValue, sort: selectedSort })} + alt="" /> - - + ); } @@ -76,12 +81,10 @@ export default connect( HomeSearchBox.defaultProps = { lastItems: [ { - name: "تمامی دوره‌ها", - icon: "", + name: "علوم", }, { - name: "جدیدترین‌ها", - icon: "", + name: "ریاضی", }, ], }; diff --git a/src/components/Navbar/index.scss b/src/components/Navbar/index.scss index 7155cd7..82cbdcb 100644 --- a/src/components/Navbar/index.scss +++ b/src/components/Navbar/index.scss @@ -28,7 +28,7 @@ } } &___share{ - background-color: #46454A; + border: 2px solid #46454A; } &___login{ background-color: #81C342; diff --git a/src/components/PrivateRouter/index.js b/src/components/PrivateRouter/index.js index 699d7eb..017d7c6 100644 --- a/src/components/PrivateRouter/index.js +++ b/src/components/PrivateRouter/index.js @@ -6,16 +6,17 @@ const PrivateRouter = ({ component: Component, restricted, status, + customPage, ...rest }) => { return ( - status ? ( + restricted ? ( ) : ( - + ) } diff --git a/src/custom.scss b/src/custom.scss index 13d137d..936b874 100644 --- a/src/custom.scss +++ b/src/custom.scss @@ -1,8 +1,9 @@ .submit { background-color: #4dd35b; color: white; - border-radius: 10px; + border-radius: 6px; border: 0px; + font-weight: 300; } .mobile, diff --git a/src/redux/reducers/user.tsx b/src/redux/reducers/user.tsx index 9137070..f254c14 100644 --- a/src/redux/reducers/user.tsx +++ b/src/redux/reducers/user.tsx @@ -1,6 +1,7 @@ import proxy from "../proxy"; import { toast } from "react-toastify"; import { UserAction} from '../actions-type' +import { error } from "console"; const initialState = { status: proxy.status(), loading: false, @@ -10,6 +11,7 @@ const initialState = { mothers: [], profileStatus: false, setDone: false, + setLogin : false, }; export default function user(state = initialState, action : UserAction) { let { type, data } = action; @@ -26,6 +28,7 @@ export default function user(state = initialState, action : UserAction) { loading: false, status: data.profile, error: null, + setLogin: !state.setLogin, }; case "user/getProfile": localStorage.setItem("userData", JSON.stringify(data)); diff --git a/src/router.js b/src/router.js index 393b52c..89c3c3a 100644 --- a/src/router.js +++ b/src/router.js @@ -1,9 +1,5 @@ import "./App.css"; -import { - BrowserRouter as Router, - Route, - Switch, -} from "react-router-dom"; +import { BrowserRouter as Router, Route, Switch } from "react-router-dom"; import { connect } from "react-redux"; import Auth from "./views/Auth"; @@ -15,7 +11,7 @@ import Contact from "./views/Contact"; import Faq from "./views/Faq"; import PrivateRouter from "./components/PrivateRouter"; import Courses from "./views/Courses"; -import About from './views/About'; +import About from "./views/About"; // import proxy from "./redux/proxy"; function router({ status }) { @@ -25,8 +21,20 @@ function router({ status }) { - - + + @@ -51,6 +59,9 @@ function router({ status }) { + {/* + + */} ); diff --git a/src/views/Auth/Login/index.scss b/src/views/Auth/Login/index.scss index 9795ba5..3b93937 100644 --- a/src/views/Auth/Login/index.scss +++ b/src/views/Auth/Login/index.scss @@ -9,7 +9,7 @@ color: #84de56; } } - button { + button[type="submit"] { margin-top: 25px; background-color: #84de56; color: white; diff --git a/src/views/Auth/SignUp/index.scss b/src/views/Auth/SignUp/index.scss index 55f329d..5ea9073 100644 --- a/src/views/Auth/SignUp/index.scss +++ b/src/views/Auth/SignUp/index.scss @@ -12,7 +12,7 @@ bottom: 0px; left: 0px; } - button { + button[type="submit"] { margin-top: 25px; background-color: #84de56; color: white; diff --git a/src/views/Auth/SignUp/index.tsx b/src/views/Auth/SignUp/index.tsx index 59af416..a55bbb1 100644 --- a/src/views/Auth/SignUp/index.tsx +++ b/src/views/Auth/SignUp/index.tsx @@ -1,4 +1,5 @@ import React, { useState, useRef, useEffect } from "react"; +import {useHistory} from 'react-router-dom'; import Navbar from "../../../components/Navbar"; import Footer from "../../Home/Footer"; import Timer from "../../../components/Timer"; @@ -17,13 +18,14 @@ interface SignUpFields { otp?: String; } -function SignUp({ sendOtp, sendPhoneNumber }: any) { +function SignUp({ sendOtp, sendPhoneNumber, loginFlag }: any) { const [level, setLevel] = useState("phonenumber"); const [signUpFields, setSignUpFiels] = useState( undefined ); const [error, setError] = useState(undefined); const [resend, setResend] = useState(false); + const history = useHistory(); const onChange = (name: string, value: string) => { setSignUpFiels({ ...signUpFields, [name]: value }); @@ -83,6 +85,12 @@ function SignUp({ sendOtp, sendPhoneNumber }: any) { } }, [level]); + useEffect(() => { + if(loginFlag){ + history.push('/'); + } + },[loginFlag]); + return (
@@ -171,7 +179,9 @@ function SignUp({ sendOtp, sendPhoneNumber }: any) { ); } -export default connect(() => ({}), { +export default connect((state : any) => ({ + loginFlag : state.user.setLogin, +}), { sendOtp: user.otp_login, sendPhoneNumber: user.otp, })(SignUp); diff --git a/src/views/Home/Courses/index.tsx b/src/views/Home/Courses/index.tsx index 319ba14..6134ce6 100644 --- a/src/views/Home/Courses/index.tsx +++ b/src/views/Home/Courses/index.tsx @@ -11,7 +11,7 @@ function Courses({number, courses, selectedSort} : any) { if (window.innerWidth >= 1440) { return 5; } else if (window.innerWidth >= 1008 && window.innerWidth < 1440) { - return 5; + return 4; } else if (window.innerWidth > 640 && window.innerWidth < 1008) { return 3; } else { diff --git a/src/views/Subscription/DiscountCode/index.scss b/src/views/Subscription/DiscountCode/index.scss index 4c833b3..658cf0b 100644 --- a/src/views/Subscription/DiscountCode/index.scss +++ b/src/views/Subscription/DiscountCode/index.scss @@ -16,8 +16,8 @@ } input{ background-color : rgba(255, 255, 255, 0.06); - border-top-right-radius: 10px; - border-bottom-right-radius: 10px; + border-top-right-radius: 6px; + border-bottom-right-radius: 6px; border: 0px; color: #aaa; &::placeholder{ @@ -26,9 +26,9 @@ } button{ background-color : #81C342; - border-top-left-radius: 10px; + border-top-left-radius: 6px; color: white; - border-bottom-left-radius: 10px; + border-bottom-left-radius: 6px; border: none; } } diff --git a/src/views/Subscription/SubscribeRadio/index.scss b/src/views/Subscription/SubscribeRadio/index.scss index 47afe6b..ef0735c 100644 --- a/src/views/Subscription/SubscribeRadio/index.scss +++ b/src/views/Subscription/SubscribeRadio/index.scss @@ -4,6 +4,7 @@ margin-bottom: 15px; border-radius: 10px; cursor: pointer; + transition: all 0.5s; &__name{ border-top-right-radius: 10px; border-bottom-right-radius: 10px; @@ -16,7 +17,6 @@ border-top-left-radius: 10px; border-bottom-left-radius: 10px; background-color: rgba(255, 255, 255, 0.18); - padding : 10px 20px 10px 0px; strong, b{ color: white; @@ -78,7 +78,6 @@ } &__factor{ flex: 3; - padding-right: 65px; &--tag{ font-size: 11px; } @@ -114,7 +113,6 @@ } &__factor{ flex: 3; - padding-right: 70px; &--tag{ font-size: calc(100vw / 130); } diff --git a/src/views/Subscription/SubscribeRadio/index.tsx b/src/views/Subscription/SubscribeRadio/index.tsx index 78b74f0..05a7f5c 100644 --- a/src/views/Subscription/SubscribeRadio/index.tsx +++ b/src/views/Subscription/SubscribeRadio/index.tsx @@ -36,7 +36,7 @@ function SubscribeRadio({ data, selectedVOD, selectVOD }: any) { />

{data.name}

-
+
{/* {data.offPercent !== 0 && ( */}
diff --git a/src/views/Subscription/index.scss b/src/views/Subscription/index.scss index b45eafa..7bfc537 100644 --- a/src/views/Subscription/index.scss +++ b/src/views/Subscription/index.scss @@ -19,7 +19,7 @@ font-size: 24px; } p{ - font-size: 16px; + font-size: 14px; } } }