Sign Up Test Page

In this example below you will see how to do a Sign Up Test Page with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by 123Fives, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright 123Fives ©

Technologies

  • HTML
  • CSS
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>Sign Up Test Page</title>
  
  
  <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'>

      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'>

<div class="login">
  <main id="app"></main>
</div>
  <script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react-dom.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/redux/3.6.0/redux.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react-redux/4.4.5/react-redux.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/redux-thunk/2.1.0/redux-thunk.min.js'></script>
<script src='https://unpkg.com/react-redux-form@1.0.0-beta.11/umd/ReactReduxForm.min.js'></script>
<script src='https://cdn.jsdelivr.net/redux.logger/2.7.0/index.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/validator/6.0.0/validator.min.js'></script>

  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/123Fives/sign-up-test-page-aWzKYq */
html, body {
  height: 100%;
  background-color: #1b1e36;
  font-family: 'Montserrat', sans-serif;
  text-transform: uppercase;
  color: #fff;
  font-size: 12px;
  letter-spacing: 1px;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  /*margin: 40px 0px 40px 0px; */
}

.login {
  position: relative;
  height: 600px;
  width: 505px;
  margin: auto;
  padding: 60px 60px;
  background-image: url("https://images.unsplash.com/photo-1438557068880-c5f474830377");
  background-repeat: no-repeat;
  background-size: cover;
  background-size: cover;
  box-shadow: 0px 30px 60px -5px #000;
}

.container {
  width: 300px;
  line-height: 30px;
}

.form-control.active {
  box-shadow: 0 0 5px 1px #008000;
}
.form-control.active.invalid {
  box-shadow: 0 0 5px 1px #bd3535;
}

.errors {
  color: #bd3535;
  font-size: 12px;
  font-weight: bold;
  margin: 5px;
}
.errors > span {
  display: block;
}

.note {
  color: #fff;
  margin: 20px 0;
  text-align: center;
  opacity: 0.5;
  text-decoration: none;
}
.note:hover {
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

.btn-primary {
  background-color: #1b1e36;
  color: #fff;
  width: 100%;
  padding: 10px 20px;
  display: block;
  height: 39px;
  border-radius: 20px;
  margin-top: 60px;
  transition: all 0.5s ease-in-out;
  border: none;
  text-transform: uppercase;
}
.btn-primary:hover {
  background: #94762c;
  box-shadow: 0 4px 35px -5px #94762c;
  cursor: pointer;
}
.btn-primary:focus {
  outline: none;
}


/*Downloaded from https://www.codeseek.co/123Fives/sign-up-test-page-aWzKYq */
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var _React = React,
    Component = _React.Component;
var _ReactRedux = ReactRedux,
    Provider = _ReactRedux.Provider,
    connect = _ReactRedux.connect;
var _Redux = Redux,
    createStore = _Redux.createStore,
    applyMiddleware = _Redux.applyMiddleware;
var _ReactReduxForm = ReactReduxForm,
    Control = _ReactReduxForm.Control,
    Errors = _ReactReduxForm.Errors,
    Form = _ReactReduxForm.Form,
    combineForms = _ReactReduxForm.combineForms,
    actions = _ReactReduxForm.actions;

var thunk = ReduxThunk.default;

var initialUserState = {
  username: 'test@email.com',
  password: '',
  passwordConfirm: ''
};

var store = createStore(combineForms({
  user: initialUserState
}), applyMiddleware(thunk, reduxLogger()));

var UserForm = function (_Component) {
  _inherits(UserForm, _Component);

  function UserForm(props) {
    _classCallCheck(this, UserForm);

    var _this = _possibleConstructorReturn(this, (UserForm.__proto__ || Object.getPrototypeOf(UserForm)).call(this, props));

    _this.handleSubmit = _this.handleSubmit.bind(_this);
    return _this;
  }

  _createClass(UserForm, [{
    key: 'handleSubmit',
    value: function handleSubmit() {
      var dispatch = store.dispatch;

      var user = store.getState().user;

      console.log(user);
    }
  }, {
    key: 'render',
    value: function render() {
      var _this2 = this;

      var getUserClassName = function getUserClassName(field) {
        var userForm = store.getState().forms.user;
        var isTouched = userForm[field].touched;
        var isValid = userForm[field].valid;

        return 'form-control' + (isTouched || _this2.props.submitFailed ? ' active' : '') + (!isValid ? ' invalid' : '');
      };

      var MyTextInput = function MyTextInput(props) {
        var _props$name$split = props.name.split('.'),
            _props$name$split2 = _slicedToArray(_props$name$split, 2),
            name = _props$name$split2[1];

        var className = getUserClassName(name);

        return React.createElement('input', _extends({
          className: className,
          autoComplete: 'off'
        }, props));
      };

      var showErrors = function showErrors(field) {
        var form = store.getState().forms.user.$form;

        return !field.pristine || form.submitFailed;
      };

      return React.createElement(
        Form,
        { model: 'user' },
        React.createElement(
          'div',
          { className: 'form-group' },
          React.createElement(
            'label',
            null,
            'Username'
          ),
          React.createElement(Control.text, {
            model: '.username',
            component: MyTextInput,
            validators: {
              required: function required(val) {
                return val && val.length;
              },
              validEmail: validator.isEmail
            }
          }),
          React.createElement(Errors, {
            className: 'errors',
            model: 'user.username',
            show: showErrors,
            messages: {
              required: 'Username is required',
              validEmail: 'Need Valid email address'
            }
          })
        ),
        React.createElement(
          'div',
          { className: 'form-group' },
          React.createElement(
            'label',
            null,
            'Password'
          ),
          React.createElement(Control.text, {
            model: '.password',
            component: MyTextInput,
            validators: {
              required: function required(val) {
                return val && val.length;
              },
              length: function length(val) {
                return val.length == 0 || val.length > 4;
              }
            }
          }),
          React.createElement(Errors, {
            className: 'errors',
            model: 'user.password',
            show: showErrors,
            messages: {
              required: 'Password is required',
              length: 'Longer than 4 chars'
            }
          })
        ),
        React.createElement(
          'div',
          { className: 'form-group' },
          React.createElement(
            'label',
            null,
            'Confirm Password'
          ),
          React.createElement(Control.text, {
            model: '.passwordConfirm',
            component: MyTextInput,
            validators: {
              required: function required(val) {
                return val && val.length;
              },
              matches: function matches(val) {
                return val === store.getState().user.password;
              }
            }
          }),
          React.createElement(Errors, {
            className: 'errors',
            model: 'user.passwordConfirm',
            show: showErrors,
            messages: {
              required: 'Confirm Password is required',
              matches: 'Passwords do not match'
            }
          })
        ),
        React.createElement(
          'button',
          { onClick: this.handleSubmit, className: 'btn btn-primary' },
          'Submit'
        )
      );
    }
  }]);

  return UserForm;
}(Component);

var BasicForm = connect(function (state) {
  var submitFailed = state.forms.user.$form.submitFailed;


  return { submitFailed: submitFailed };
})(UserForm);

var App = function (_React$Component) {
  _inherits(App, _React$Component);

  function App() {
    _classCallCheck(this, App);

    return _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).apply(this, arguments));
  }

  _createClass(App, [{
    key: 'render',
    value: function render() {
      return React.createElement(
        'div',
        { className: 'container' },
        React.createElement(
          Provider,
          { store: store },
          React.createElement(BasicForm, null)
        ),
        React.createElement(
          'a',
          { href: '' },
          React.createElement(
            'p',
            { className: 'note' },
            'Forgot Password'
          )
        )
      );
    }
  }]);

  return App;
}(React.Component);

ReactDOM.render(React.createElement(App, null), document.getElementById('app'));

Comments