Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from "react";
- import { Col } from "react-bootstrap";
- import { withFormik, Form, Field } from "formik";
- const Login = ({ errors, touched }) => (
- <Form className="form-horizontal">
- <fieldset>
- <legend className="text-center">
- <h2>Login</h2>
- </legend>
- <div className="form-group">
- <label className="col-lg-2 control-label">Username</label>
- <div className="col-lg-10">
- <Field
- type="text"
- className="form-control"
- placeholder="username"
- name="username"
- />
- {errors.username && touched.username && errors.username}
- </div>
- </div>
- <div className="form-group">
- <label htmlFor="inputPassword" className="col-lg-2 control-label">
- Password
- </label>
- <div className="col-lg-10">
- <Field
- type="password"
- className="form-control"
- placeholder="Password"
- name="password"
- />
- {errors.password && touched.password && errors.password}
- </div>
- </div>
- <div className="form-group">
- <Col lg={10} lgOffset={2}>
- <button
- // disabled={this.props.user.isLogging}
- className="btn btn-primary login-button btn-block LoginButton"
- // disabled={this.state.isEnabled}
- // onClick={this.handlesOnLogin}
- >
- <span> Login </span>
- </button>
- </Col>
- </div>
- </fieldset>
- </Form>
- );
- const formikEnhancer = withFormik({
- initialValues: { username: "", password: "" },
- handleSubmit: (values, { setSubmitting }) => {
- setTimeout(() => {
- alert(JSON.stringify(values, null, 2));
- setSubmitting(false);
- }, 400);
- }
- });
- export default formikEnhancer(Login);
Add Comment
Please, Sign In to add comment