GithubHelp home page GithubHelp logo

akiokio / reactsignuplogincomponent Goto Github PK

View Code? Open in Web Editor NEW
30.0 5.0 18.0 4.42 MB

The React SignupLogin Component is a drop in login/register/forgotPassword component to speed up development.

Home Page: https://akiokio.github.io/ReactSignupLoginComponent/

License: MIT License

JavaScript 15.83% HTML 82.25% CSS 1.92%
react login signup component

reactsignuplogincomponent's Introduction

ReactSignupLoginComponent

Greenkeeper badge Coverage Status Build Status semantic-release

Check out the examples to learn how to use it.

Features

  • Updated to React 16 ๐ŸŽ‰
  • Login
  • Signup
  • Recover Password
  • Callbacks for every action
  • 100% test coverage
  • Drop-in component
  • Custom labels for any text nice for customization or internationalization

How to use it

Installing

Using npm:

$ npm install react-signup-login-component

Using yarn:

$ yarn add react-signup-login-component

Getting started

import ReactSignupLoginComponent from 'react-signup-login-component';

const LoginPage = (props) => {
    const signupWasClickedCallback = (data) => {
      console.log(data);
      alert('Signup callback, see log on the console to see the data.');
    };
    const loginWasClickedCallback = (data) => {
      console.log(data);
      alert('Login callback, see log on the console to see the data.');
    };
    const recoverPasswordWasClickedCallback = (data) => {
      console.log(data);
      alert('Recover password callback, see log on the console to see the data.');
    };
    return (
        <div>
            <ReactSignupLoginComponent
                title="My awesome company"
                handleSignup={signupWasClickedCallback}
                handleLogin={loginWasClickedCallback}
                handleRecoverPassword={recoverPasswordWasClickedCallback}
            />
        </div>
    );
};

export default LoginPage;

Configuration (Props) options

Required props

handleSignup(object)

Called when the users clicks on the signup button and the form is valid return: An object with the attributes: username, password and passwordConfirmation example:

{
  username: 'johndoe',
  password: '1234%##D',
  passwordConfirmation: '1234%##D'
};

handleLogin(object)

Called when the users clicks on the login button and the form is valid return: An object with the attributes: username and password example:

{
  username: 'johndoe',
  password: '1234%##D'
};

handleRecoverPassword(object)

Called when the users clicks on the recover password button and the form is valid return: An object with the attributes: username example:

{
  username: 'johndoe'
};

Optional props

title

Sets the h1 title on the login box example:

<Wrapper
  title="My awesome company"
  {...requiredProps} // Spread the default props. It's here to illustrate the example
/>

styles

You can overhide the component style passing an object to the styles prop. Here's an example with all the possible keys. The values can be any valid css property. example:

<ReactSignupLoginComponent
  styles={{
    mainWrapper: { backgroundColor: 'blue' },
    mainTitle: { color: 'red' },
    flipper: { transition: '0.1s' },
    signup: {
      wrapper: { backgroundColor: 'yellow' },
      inputWrapper: { backgroundColor: 'AliceBlue' },
      buttonsWrapper: { backgroundColor: 'Aqua' },
      input: { backgroundColor: 'LavenderBlush' },
      recoverPassword: {},
      button: { backgroundColor: 'LightCoral' },
    },
    login: {
      wrapper: { backgroundColor: 'yellow' },
      inputWrapper: { backgroundColor: 'AliceBlue' },
      buttonsWrapper: { backgroundColor: 'Aqua' },
      input: { backgroundColor: 'LavenderBlush' },
      recoverPasswordWrapper: { backgroundColor: 'MediumBlue' },
      recoverPasswordButton: { backgroundColor: 'OldLace ' },
      button: { backgroundColor: 'LightCoral' },
    },
    recoverPassword: {
      wrapper: { backgroundColor: 'yellow' },
      inputWrapper: { backgroundColor: 'AliceBlue' },
      buttonsWrapper: { backgroundColor: 'Aqua' },
      input: { backgroundColor: 'LavenderBlush' },
      button: { backgroundColor: 'LightCoral' },
    },
  }}
  {...requiredProps} // Spread the default props. It's here to illustrate the example
/>

Custom labels

Here's the list of possible custom labels you can use (check the storybook for usage):

usernameCustomLabel="Anything you want"
passwordCustomLabel="Anything you want"
passwordConfirmationCustomLabel="Anything you want"
recoverPasswordCustomLabel="Anything you want"
signupCustomLabel="Anything you want"
submitLoginCustomLabel="Anything you want"
goToLoginCustomLabel="Anything you want"
submitSignupCustomLabel="Anything you want"
goToSignupCustomLabel="Anything you want"
submitRecoverPasswordCustomLabel="Anything you want"

Tests

We have a 100% percent test coverage, to run the tests locally:

$ git clone https://github.com/akiokio/ReactSignupLoginComponent
$ cd ReactSignupLoginComponent
$ yarn install
$ yarn test
or to get the coverage report
$ yarn coverage

Issues

If you found something wrong with the component please open an issue here: https://github.com/akiokio/ReactSignupLoginComponent/issues/new

Notes

This readme is a working in progress, feel free to help update it making a pull request

License

Licensed under the MIT License: https://opensource.org/licenses/MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.