npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-login-modal

v1.2.1

Published

Functional responsive login and signup modal with validation for React JS

Downloads

36

Readme

React Login Modal

React Login Modal is a functional responsive login and signup modal with validation which supports custom configurable UI properties.

  • Validation for login and sign up
  • CSS customizable - Styles of button color, font styles and font color
  • Custom errors - User authentication errors can be passed as additional validation

NPM JavaScript Style Guide

NPM

Installation

Can be installed via npm:

npm install --save react-login-modal

Or yarn

yarn add react-login-modal

Usage

The most basic use of the login modal can be described with :

import React, { Component } from "react";
import LoginModal from "react-login-modal";

class Example extends Component {
  handleSignup = (username, email, password) => {};
  handleLogin = (username, password) => {}

  render() {
    return (
      <LoginModal
        handleSignup={this.handleSignup}
        handleLogin={this.handleLogin}
      />
    );
  }
}

Registration validation

Validation to set the sign up button enable,

  • Username must contain at least three characters
  • Email validation
  • Password at least should contains eight characters, at least one letter and one number
  • Password and confirm password should be matched
  • Input fields can not be empty

reg

Login validation

Validation to set the login button enable,

  • Username and password fields can not be empty

login

CSS Properties can be customized as shown below:

import React, { Component } from "react";
import LoginModal from "react-login-modal";

class Example extends Component {
  handleSignup = (username, email, password) => {};
  handleLogin = (username, password) => {}

  render() {
    return (
      <LoginModal
        handleSignup={this.handleSignup}
        handleLogin={this.handleLogin}
        buttonColor={"#52AE64"}
        disabledButtonColor={"#C7E4CD"}
        buttonHoverColor={"#A7D5B0"}
        fontFamily={"roboto"}
        errorMessage={"Incorrect username or password"}
        errorEnable={true}
      />
    );
  }
}

errorEnable and errorMessage are used to prompt an customized error for login/sign up. These erros can be shown by setting errorEnable, true and passing an error message to errorMessage as showed in the example

login

Properties

Property | Type | Default | Description --- | --- | --- | --- buttonColor | string | #5264AE | Button color to be applied for login and sign up
disabledButtonColor | string | #a8b1d6 | Button color to be applied for login and sign up when the button is disabled buttonHoverColor | string | #6373b6 | Button color to be applied for login and sign up when the mouse hover event gets triggered fontFamily | string | Nunito, Roboto, Arial, sans-serif | Font style to be applied to the component errorMessage | string | Username or password is incorrect❓ | Authentication error message to be shown to disable login and sign up buttons errorEnable | bool | false | Enable custom error messages

Callbacks

Property | Type | Description --- | --- | --- handleSignup | func | Gets called when the sign up button is clicked with the validated username, email, password handleLogin | func | Gets called when the login button is clicked with the authenticated username, password

Sample Code

Code sample is available in the /example directory for your perusal. You can execute npm install to generate the necessary dependencies for the examples.

if you haven't, You may need to install,

npm or nvm (Go with nvm, its much easier to switch versions!) Node 8.16.0 or Node 10.16.0 or later version

Compatibility

React

Compatible with the latest version of 16.x

Latest compatible versions:

  • 15.x and 16.x

License

MIT © HasiniWijerathna