UserLayout.tsx 2.3 KB
Newer Older
1
import SelectLang from '@/components/SelectLang';
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
2
import GlobalFooter from '@/components/GlobalFooter';
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
3
import { ConnectProps } from '@/models/connect';
4 5
import { Icon } from 'antd';
import React, { Component, Fragment } from 'react';
Yu's avatar
Yu committed
6
import DocumentTitle from 'react-document-title';
7 8
import { formatMessage } from 'umi-plugin-locale';
import Link from 'umi/link';
9
import logo from '../assets/logo.svg';
10
import styles from './UserLayout.less';
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
11
import { MenuDataItem, getPageTitle, getMenuData } from '@ant-design/pro-layout';
xiaohu's avatar
xiaohu committed
12

jim's avatar
jim committed
13 14 15
const links = [
  {
    key: 'help',
16
    title: formatMessage({ id: 'layout.user.link.help' }),
jim's avatar
jim committed
17 18 19 20
    href: '',
  },
  {
    key: 'privacy',
21
    title: formatMessage({ id: 'layout.user.link.privacy' }),
jim's avatar
jim committed
22 23 24 25
    href: '',
  },
  {
    key: 'terms',
26
    title: formatMessage({ id: 'layout.user.link.terms' }),
jim's avatar
jim committed
27 28 29
    href: '',
  },
];
30

jim's avatar
jim committed
31 32
const copyright = (
  <Fragment>
hexuebin001's avatar
hexuebin001 committed
33
    Copyright <Icon type="copyright" /> 2019 ่š‚่š้‡‘ๆœไฝ“้ชŒๆŠ€ๆœฏ้ƒจๅ‡บๅ“
jim's avatar
jim committed
34 35
  </Fragment>
);
36

ไฝ•ไน's avatar
ไฝ•ไน committed
37 38
export interface UserLayoutProps extends ConnectProps {
  breadcrumbNameMap: { [path: string]: MenuDataItem };
39 40 41 42
  navTheme: string;
}

class UserLayout extends Component<UserLayoutProps> {
43
  render() {
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
44 45 46 47 48 49 50 51
    const {
      route = {
        routes: [],
      },
    } = this.props;
    const { routes = [] } = route;
    const { children, location } = this.props;
    const { breadcrumb } = getMenuData(routes, this.props);
52
    return (
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
53 54 55 56 57 58 59
      <DocumentTitle
        title={getPageTitle({
          pathname: location!.pathname,
          breadcrumb,
          formatMessage,
        })}
      >
Yu's avatar
Yu committed
60 61 62 63 64 65 66 67 68 69 70 71 72
        <div className={styles.container}>
          <div className={styles.lang}>
            <SelectLang />
          </div>
          <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>
              </div>
              <div className={styles.desc}>Ant Design ๆ˜ฏ่ฅฟๆน–ๅŒบๆœ€ๅ…ทๅฝฑๅ“ๅŠ›็š„ Web ่ฎพ่ฎก่ง„่Œƒ</div>
73
            </div>
Yu's avatar
Yu committed
74
            {children}
75
          </div>
Yu's avatar
Yu committed
76
          <GlobalFooter links={links} copyright={copyright} />
77
        </div>
Yu's avatar
Yu committed
78
      </DocumentTitle>
79 80 81 82
    );
  }
}

้™ˆๅธ…'s avatar
้™ˆๅธ… committed
83
export default UserLayout;