Advertisement
zingga

Kode Sign up react-redux

Dec 6th, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component } from 'react';
  2. import { Form, Icon, Input, Button, Checkbox } from 'antd';
  3. const FormItem = Form.Item;
  4.  
  5. class Masuk extends Component {
  6.    
  7.     handleSubmit(e) {
  8.         e.preventDefault();
  9.         this.props.form.validateFields((err, values) => {
  10.             if (!err) {
  11.                 console.log('Received values of form: ', values);
  12.             }
  13.         });
  14.     }
  15.  
  16.     render() {             
  17.         const { getFieldDecorator } = this.props.form;
  18.  
  19.         return (
  20.             <div>
  21.                 <Form onSubmit={this.handleSubmit} className="login-form">
  22.                     <FormItem>
  23.                         {getFieldDecorator('userName', {
  24.                             rules: [{ required: true, message: 'Please input your username!' }],
  25.                         })(
  26.                             <Input addonBefore={<Icon type="user" />} placeholder="Username" />
  27.                         )}
  28.                     </FormItem>
  29.  
  30.                     <FormItem>
  31.                     {getFieldDecorator('password', {
  32.                         rules: [{ required: true, message: 'Please input your Password!' }],
  33.                     })(
  34.                         <Input addonBefore={<Icon type="lock" />} type="password" placeholder="Password" />
  35.                     )}
  36.                     </FormItem>
  37.  
  38.                     <FormItem>
  39.                         {getFieldDecorator('remember', {
  40.                             valuePropName: 'checked',
  41.                             initialValue: true,
  42.                         })(
  43.                             <Checkbox>Remember me</Checkbox>
  44.                         )}
  45.                         <a className="login-form-forgot">Forgot password</a>
  46.                         <Button type="primary" htmlType="submit" className="login-form-button">
  47.                             Log in
  48.                         </Button>
  49.                         Or <a>register now!</a>
  50.                     </FormItem>
  51.                 </Form>
  52.             </div>
  53.         );
  54.     }
  55. }
  56.  
  57. export default Masuk;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement