ant-design/site/component/Resource/index.jsx

50 lines
1.4 KiB
React
Raw Normal View History

2016-02-29 14:08:40 +08:00
import React from 'react';
import { Link } from 'react-router';
import { Row, Col, Menu } from '../../../';
2016-03-01 17:05:24 +08:00
import * as utils from '../utils';
2016-02-29 14:08:40 +08:00
export default class Resource extends React.Component {
2016-03-01 17:05:24 +08:00
getMenuItems() {
return [
<Menu.Item key="download">
<Link to="/resource/download">
资源下载
</Link>
</Menu.Item>,
<Menu.Item key="reference">
<Link to="/resource/reference">
文献素材
</Link>
</Menu.Item>,
<Menu.Item key="github">
<a href="https://github.com/ant-design/ant-design" target="_blank">
GitHub
</a>
</Menu.Item>,
];
}
2016-02-29 14:08:40 +08:00
render() {
2016-03-01 17:05:24 +08:00
const activeMenuItem = utils.getActiveMenuItem(this.props, 'download');
const menuItems = this.getMenuItems();
const { prev, next } = utils.getFooterNav(menuItems, activeMenuItem);
2016-03-01 16:20:32 +08:00
2016-02-29 14:08:40 +08:00
return (
<Row className="main-wrapper">
<Col span="4">
2016-03-01 16:20:32 +08:00
<Menu mode="inline" selectedKeys={[activeMenuItem]}>
2016-03-01 17:05:24 +08:00
{ menuItems }
2016-02-29 14:08:40 +08:00
</Menu>
</Col>
<Col span="20" className="main-container">
{ this.props.children }
2016-03-01 17:05:24 +08:00
<section className="prev-next-nav">
{ !!prev ? React.cloneElement(prev.props.children, { className: 'prev-page' }) : null }
{ !!next ? React.cloneElement(next.props.children, { className: 'next-page' }) : null }
</section>
2016-02-29 14:08:40 +08:00
</Col>
</Row>
);
}
}