/**
 *
 * NotFound
 *
 */

import M from 'immutable';
import React from 'react';
import { connect } from 'react-redux';
import { Row, Col, Button } from 'antd';
import styles from './styles.less';

export class NotFound extends React.Component { // eslint-disable-line react/prefer-stateless-function
  /**
   * constructor
   *
   * @name constructor
   * @function
   * @param props {
   *    title String
   *    content String
   *    goback Function
   * }
   * @returns {undefined}
   */
  constructor(props) {
    super(props);

    this.goback = this.goback.bind(this);

    this.state = {
      title: props.title || '页面未找到'
    };
  }

  render() {
    return (
      <div className={styles.notFound}>
        <div className="panel panel-default">
          <div className="panel-heading">
            <h3>{this.state.title}</h3>
          </div>
          <div className="panel-body">
            <p className='lead'>{this.props.content ? this.props.content : '您访问的页面不存在'}</p>
          </div>
          <div className="panel-footer">
            <div>
              <Button type="ghost" onClick={this.props.goback ? this.props.goback : this.goback}>返回</Button>
            </div>
          </div>
        </div>
      </div>
    );
  }

  goback() {
    history.back();
  }
}

export default NotFound;
