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

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

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

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

42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
const UserLayout: React.SFC<UserLayoutProps> = props => {
  const {
    route = {
      routes: [],
    },
  } = props;
  const { routes = [] } = route;
  const {
    children,
    location = {
      pathname: '',
    },
  } = props;
  const { breadcrumb } = getMenuData(routes, props);

  return (
    <DocumentTitle
      title={getPageTitle({
        pathname: location.pathname,
        breadcrumb,
        formatMessage,
        ...props,
      })}
    >
      <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>
77
            </div>
78
            <div className={styles.desc}>Ant Design ๆ˜ฏ่ฅฟๆน–ๅŒบๆœ€ๅ…ทๅฝฑๅ“ๅŠ›็š„ Web ่ฎพ่ฎก่ง„่Œƒ</div>
79
          </div>
80
          {children}
81
        </div>
82 83 84 85 86
        <GlobalFooter links={links} copyright={copyright} />
      </div>
    </DocumentTitle>
  );
};
87

88 89 90
export default connect(({ settings }: ConnectState) => ({
  ...settings,
}))(UserLayout);