This project was created for Noventiq.
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.
The page will reload when you make changes.
You may also see any lint errors in the console.
The Login
component handles user login functionalities with state management and basic form validation. Here are the main features:
-
State Management:
- Manages states for email, password, rememberMe, language, showPassword, and emailError using React's
useState
hook.
- Manages states for email, password, rememberMe, language, showPassword, and emailError using React's
-
Language Detection:
- Detects and sets the user's browser language preference (
'en'
,'hi'
,'bn'
). Defaults to English if the browser language is unsupported.
- Detects and sets the user's browser language preference (
-
Remember Me Functionality:
- Checks for a
rememberMe
cookie on component mount to pre-fill the email and set the rememberMe checkbox.
- Checks for a
-
Event Handlers:
handleEmailChange
: Updates email state and clears email error.handlePasswordChange
: Updates password state.togglePasswordVisibility
: Toggles password visibility between text and password.handleLanguageChange
: Updates language state.handleRememberMeChange
: Manages the rememberMe state and corresponding cookie.handleFormSubmit
: Prevents default form submission, validates the email, and logs the form data.
-
Validation:
validateEmail
: Validates the email format and ensures it's from a valid corporate domain (noventiq.com
).validatePassword
: Validates the password, it shouldn't be blank.
-
Cookie Management:
setCookie
: Sets a cookie with a specified name, value, and expiration period.getCookie
: Retrieves a cookie by its name.deleteCookie
: Deletes a cookie by setting its expiration date to a past date.
-
JSX Structure:
- Includes input fields for email and password, a language dropdown, and a remember-me checkbox.
- Displays email validation error messages.
- Provides a password visibility toggle feature.
- A submit button to trigger form validation and log the form data.
The Header
component is responsible for displaying logo of the application. Here are the main features:
- JSX Structure:
- Includes the application logo.
The Footer
component displays the bottom section of the application. Here are the main features:
-
Static Content:
- Displays the following text: "Copyright 2024 Noventiq | Powered by Noventiq".
-
JSX Structure:
- Includes the static content mentioned above.
The ForgotPassword
component displays the input of the application.
- Clone the repository.
- Navigate to the project directory.
- Run
npm install
to install dependencies. - Run
npm start
to start the development server. - Open http://localhost:3000 in your browser to view the application.
-
src
: Contains the styles for the application.index.js
: Entry point for the React application.
-
src/components
: Contains the source code for the application.Login.js
: Contains theLogin
component.Header.js
: Contains theHeader
component.Footer.js
: Contains theFooter
component.
-
src/css
: Contains the styles for the application.Header.css
: Contains the styles for theHeader
component.Footer.css
: Contains the styles for theFooter
component.Login.css
: Contains the styles for theLogin
component.
-
src/translation
: Contains the translation json file for the application.en.js
: Contains the english labels.hi.js
: Contains the hindi labels.bn.js
: Contains the bengla labels.
The application uses i18next and react-i18next for internationalization. The default language is English (en), with support for Hindi (hi) and Bengali (bn). The language is automatically detected based on the user's browser settings.
Use the language dropdown in the Login component to select between English, Hindi, and Bengali. The application's content will dynamically update based on the selected language.
If you have suggestions or improvements, feel free to create a pull request or open an issue.