From 39964b189711d0d9f274a2e31c846e104dd9283b Mon Sep 17 00:00:00 2001 From: soyed Date: Wed, 7 Apr 2021 20:24:56 -0400 Subject: [PATCH] moved the translations button and validating the login form --- src/App.js | 57 +------------------ src/login-page/Login.js | 23 +++++--- src/login-page/account/Account.js | 3 +- .../navbar-component/Navbar.js | 52 ++++++++++++++++- 4 files changed, 68 insertions(+), 67 deletions(-) diff --git a/src/App.js b/src/App.js index 75af360..fd1ea5f 100644 --- a/src/App.js +++ b/src/App.js @@ -1,9 +1,7 @@ -import React, { useEffect } from "react"; +import React from "react"; import Footer from "./shared-components/footer-component/Footer"; import Navbar from "./shared-components/navbar-component/Navbar"; import { BrowserRouter, Route, Switch } from "react-router-dom"; -import i18next from "i18next"; -import Cookies from "js-cookie"; import HomePage from "./homePage/Homepage"; import ListingsPage from "./listings-page/ListingsPage"; import AgentPage from "./agent-page/AgentPage"; @@ -12,62 +10,9 @@ import Login from "./login-page/Login"; import Account from "./login-page/account/Account"; import ContactUs from "./shared-components/contact-us/contact-us"; -const langauges = [ - { - code: "fr", - name: "Français", - country_code: "fr", - }, - { - code: "en", - name: "English", - country_code: "gb", - }, -]; - function App() { - const currentLanguageCode = Cookies.get("i18next") || "en"; - const currentLanguage = langauges.find( - (lang) => lang.code === currentLanguageCode - ); - - useEffect(() => { - document.body.dir = currentLanguage.dir || "ltr"; - }, [currentLanguage]); return (
- {/* create the translations button */} -
-
- {/* */} -
- - -
-
-
diff --git a/src/login-page/Login.js b/src/login-page/Login.js index f260a7a..276856a 100644 --- a/src/login-page/Login.js +++ b/src/login-page/Login.js @@ -14,14 +14,20 @@ class Login extends Component { }, }; - handleLogin = (e) => { - console.log(e); - }; + handleLogin() { + // if ( !== this.state.Account.email) { + // alert("invalid"); + // } + // if (password !== this.state.Account.password) { + // alert("invalid"); + // } + } + render() { const { t } = this.props; return (
-
+ app-logo

{t("Login_header")}

{t("Login_message")}

@@ -61,11 +67,10 @@ class Login extends Component {
- - - + +
diff --git a/src/login-page/account/Account.js b/src/login-page/account/Account.js index 9097434..92ca733 100644 --- a/src/login-page/account/Account.js +++ b/src/login-page/account/Account.js @@ -11,6 +11,7 @@ class Account extends Component { lastName: "Green", email: "kevon.green@kcribs.com", password: "Kcribs123", + phoneNumber: "613-234-8796", }, }; render() { @@ -93,7 +94,7 @@ class Account extends Component { type="text" class="form-control" id="account-phoneNumber" - placeholder={this.state.Account.email} + placeholder={this.state.Account.phoneNumber} required disabled={true} /> diff --git a/src/shared-components/navbar-component/Navbar.js b/src/shared-components/navbar-component/Navbar.js index 42cfa11..05d5de1 100644 --- a/src/shared-components/navbar-component/Navbar.js +++ b/src/shared-components/navbar-component/Navbar.js @@ -1,11 +1,33 @@ -import React from "react"; +import React, { useEffect } from "react"; import { Link, withRouter } from "react-router-dom"; import "./Navbar.css"; import logo from "./logo2.png"; +import Cookies from "js-cookie"; /* eslint-disable jsx-a11y/anchor-is-valid */ import { useTranslation } from "react-i18next"; +import i18next from "i18next"; +const langauges = [ + { + code: "fr", + name: "Français", + country_code: "fr", + }, + { + code: "en", + name: "English", + country_code: "gb", + }, +]; + const Navbar = () => { + const currentLanguageCode = Cookies.get("i18next") || "en"; + const currentLanguage = langauges.find( + (lang) => lang.code === currentLanguageCode + ); const { t } = useTranslation(); + useEffect(() => { + document.body.dir = currentLanguage.dir || "ltr"; + }, [currentLanguage]); return ( /* Nav Bar */
@@ -27,6 +49,34 @@ const Navbar = () => {