mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 16:06:28 +08:00
site: add versions selector
This commit is contained in:
parent
20ec00abf0
commit
fda29689c4
@ -33,4 +33,8 @@ footer ul li > div {
|
||||
|
||||
footer ul li > a {
|
||||
margin: 5px 2px 0 0;
|
||||
}
|
||||
|
||||
.versions-selector {
|
||||
width: 75px;
|
||||
}
|
@ -1,8 +1,28 @@
|
||||
import React from 'react';
|
||||
import { Select } from '../../../';
|
||||
import { version as antdVersion } from '../../../package.json';
|
||||
import { docVersions } from '../../website.config';
|
||||
const Option = Select.Option;
|
||||
|
||||
export default class Footer extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.handleVersionChange = this.handleVersionChange.bind(this);
|
||||
}
|
||||
|
||||
handleVersionChange(url) {
|
||||
window.location.href = url;
|
||||
}
|
||||
|
||||
render() {
|
||||
const options = Object.keys(docVersions).map((version, index) => {
|
||||
return (
|
||||
<Option value={docVersions[version]} key={index}>
|
||||
{ version }
|
||||
</Option>
|
||||
);
|
||||
});
|
||||
return (
|
||||
<footer id="footer">
|
||||
<ul>
|
||||
@ -38,9 +58,9 @@ export default class Footer extends React.Component {
|
||||
<div>©2015 蚂蚁金服体验技术部出品</div>
|
||||
<div>
|
||||
文档版本:
|
||||
<Select defaultValue="0.10.4" size="small">
|
||||
<Option value="0.10.4">0.10.4</Option>
|
||||
<Option value="0.9.2">0.9.2</Option>
|
||||
<Select className="versions-selector" size="small"
|
||||
placeholder={antdVersion} onChange={this.handleVersionChange}>
|
||||
{ options }
|
||||
</Select>
|
||||
</div>
|
||||
</li>
|
||||
|
@ -21,4 +21,10 @@ export default {
|
||||
'docs/react/upgrade-notes': 'components/upgrade-notes',
|
||||
CHANGELOG: 'components/changelog',
|
||||
},
|
||||
|
||||
docVersions: {
|
||||
'0.9.x': 'http://09x.ant.design/',
|
||||
'0.10.x': 'http://010x.ant.design/',
|
||||
'0.11.x': 'http://011x.ant.design/',
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user