All files / view/layout/main index.jsx

94.44% Statements 34/36
90% Branches 9/10
71.43% Functions 5/7
94.44% Lines 34/36

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 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    1x       1x   1x   1x   1x   1x   1x   1x   1x   1x   1x   1x   1x   1x   1x   1x   1x   1x   7x   1x 1x     1x 1x     1x     3x 3x 3x 3x 3x 3x   3x          
import React from 'react';
import { Link } from 'react-router-dom';
 
import logo from 'src/style/img/logo.svg';
import 'src/style/css/bootstrap.css';
import 'src/style/css/layout-main.css';
 
class MainLayout extends React.Component {
  render() {
    const {
      children,
      breadcrumbs,
      i18n: { t, switchLanguage },
    } = this.props;
    return (
      <div className="layout-container">
        <nav className="navbar navbar-inverse ">
          <div className="navbar-header">
            <ul className="nav navbar-nav">
              <li className="logo-con">
                <a>
                  <img src={logo} className="App-logo" alt="logo" />
                </a>
              </li>
              <li>
                <Link to="/main/index">{t('主页')}</Link>
              </li>
              <li>
                <Link to="/main/about/id/1003">{t('关于')}</Link>
              </li>
              <li
                onClick={e => {
                  switchLanguage('zh_CN');
                }}
                className="language"
              >
                <a>中文</a>
              </li>
              <li
                onClick={e => {
                  switchLanguage('en_US');
                }}
                className="language"
              >
                <a>英文</a>
              </li>
            </ul>
          </div>
        </nav>
        {breadcrumbs && (
          <ol className="breadcrumb">
            {breadcrumbs.map((v, k) => {
              return (
                <li key={k}>{v.link && <Link to={v.link}>{v.label}</Link>}</li>
              );
            })}
          </ol>
        )}
        <div className="main-contents">{children}</div>
      </div>
    );
  }
}
 
export default MainLayout;