index.js 977 Bytes
Newer Older
1 2 3
import React from 'react';
import classNames from 'classnames';
import { Button } from 'antd';
nikogu's avatar
nikogu committed
4
import { Link } from 'react-router';
5 6 7 8
import config from './typeConfig';
import styles from './index.less';


9
export default ({ className, type, title, desc, img, actions, ...rest }) => {
10 11 12
  const pageType = type in config ? type : '404';
  const clsString = classNames(styles.exception, className);
  return (
13
    <div className={clsString} {...rest}>
14
      <div className={styles.imgBlock}>
ddcat1115's avatar
ddcat1115 committed
15 16 17 18
        <div
          className={styles.imgEle}
          style={{ backgroundImage: `url(${img || config[pageType].img})` }}
        />
19 20 21 22 23
      </div>
      <div className={styles.content}>
        <h1>{title || config[pageType].title}</h1>
        <div className={styles.desc}>{desc || config[pageType].desc}</div>
        <div className={styles.actions}>
afc163's avatar
afc163 committed
24
          {actions || <Link to="/"><Button type="primary">θΏ”ε›žι¦–ι‘΅</Button></Link>}
25 26 27 28 29
        </div>
      </div>
    </div>
  );
};