UNPKG

nyx_server

Version:

Node内容发布

45 lines (42 loc) 1.36 kB
import React from 'react'; import { Link } from 'react-router'; import { Menu } from 'antd'; import ProjectsContainer from './ProjectsContainer'; import { connect } from 'react-redux'; class Layout extends React.Component { getCurrentPath () { var paths = window.location.href.split('/'); if (paths.length > 1) { return '/' + paths[paths.length - 1]; } else { return '/'; } } render() { return ( <div> <h2 className="nyx-project-title">{this.props.currentProject}</h2> <Menu mode="horizontal" selectedKeys={[this.getCurrentPath()]}> <Menu.Item key="/info"> <Link to = {'/manage/server/project/' + this.props.params.name + '/info'}>项目信息</Link> </Menu.Item> <Menu.Item key="/template"> <Link to = {'/manage/server/project/' + this.props.params.name + '/template'}>模板列表</Link> </Menu.Item> <Menu.Item key="/chip"> <Link to = {'/manage/server/project/' + this.props.params.name + '/chip'}>碎片列表</Link> </Menu.Item> </Menu> <div className="nyx-project-main"> {this.props.children} </div> </div> ); } } function select(state) { return { currentProject: state.project.get('currentProject') }; } export default connect(select)(Layout);