UserLayout.js 2.44 KB
Newer Older
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
1
import React, { Fragment } from 'react';
xiaohu's avatar
xiaohu committed
2
import { Link } from 'dva/router';
3
// import DocumentTitle from 'react-document-title';
4
import { Icon } from 'antd';
5
import GlobalFooter from '../../components/GlobalFooter';
6
import styles from './UserLayout.less';
7
import logo from '../../assets/logo.svg';
xiaohu's avatar
xiaohu committed
8 9 10

// TODO:remove
// import { getRoutes, getPageQuery, getQueryPath } from '../utils/utils';
11

jim's avatar
jim committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
const links = [
  {
    key: 'help',
    title: 'ๅธฎๅŠฉ',
    href: '',
  },
  {
    key: 'privacy',
    title: '้š็ง',
    href: '',
  },
  {
    key: 'terms',
    title: 'ๆกๆฌพ',
    href: '',
  },
];
29

jim's avatar
jim committed
30 31 32 33 34
const copyright = (
  <Fragment>
    Copyright <Icon type="copyright" /> 2018 ่š‚่š้‡‘ๆœไฝ“้ชŒๆŠ€ๆœฏ้ƒจๅ‡บๅ“
  </Fragment>
);
xiaohu's avatar
xiaohu committed
35 36 37 38 39 40 41 42
// TODO:remove
// function getLoginPathWithRedirectPath() {
//   const params = getPageQuery();
//   const { redirect } = params;
//   return getQueryPath('/user/login', {
//     redirect,
//   });
// }
43

44
class UserLayout extends React.PureComponent {
45 46 47 48 49 50 51 52 53 54
  // TODO title
  // getPageTitle() {
  //   const { routerData, location } = this.props;
  //   const { pathname } = location;
  //   let title = 'Ant Design Pro';
  //   if (routerData[pathname] && routerData[pathname].name) {
  //     title = `${routerData[pathname].name} - Ant Design Pro`;
  //   }
  //   return title;
  // }
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
55

56
  render() {
xiaohu's avatar
xiaohu committed
57
    const { children } = this.props;
58
    return (
59 60 61 62 63 64 65 66 67
      // TODO <DocumentTitle title={this.getPageTitle()}>
      <div className={styles.container}>
        <div className={styles.content}>
          <div className={styles.top}>
            <div className={styles.header}>
              <Link to="/">
                <img alt="logo" className={styles.logo} src={logo} />
                <span className={styles.title}>Ant Design</span>
              </Link>
68
            </div>
69 70 71 72
            <div className={styles.desc}>Ant Design ๆ˜ฏ่ฅฟๆน–ๅŒบๆœ€ๅ…ทๅฝฑๅ“ๅŠ›็š„ Web ่ฎพ่ฎก่ง„่Œƒ</div>
          </div>
          {children}
          {/* <Switch>
jim's avatar
jim committed
73 74 75 76 77 78 79 80
              {getRoutes(match.path, routerData).map(item => (
                <Route
                  key={item.key}
                  path={item.path}
                  component={item.component}
                  exact={item.exact}
                />
              ))}
81
              <Redirect from="/user" to={getLoginPathWithRedirectPath()} />
xiaohu's avatar
xiaohu committed
82
            </Switch> */}
83
        </div>
84 85 86
        <GlobalFooter links={links} copyright={copyright} />
      </div>
      // </DocumentTitle>
87 88 89 90 91
    );
  }
}

export default UserLayout;