Browse Source

docs: tweak version select option order (#42564)

* feat: test

* chore: empty

---------

Co-authored-by: afc163 <afc163@gmail.com>
pull/42697/head
叶枫 2 years ago
committed by GitHub
parent
commit
729f568723
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .stylelintrc.json
  2. 3
      site/theme/template/Layout/Header/index.tsx
  3. 7
      site/themeConfig.js

3
.stylelintrc.json

@ -39,7 +39,8 @@
"color-function-notation": "legacy", "color-function-notation": "legacy",
"selector-class-pattern": null, "selector-class-pattern": null,
"selector-id-pattern": null, "selector-id-pattern": null,
"selector-not-notation": null "selector-not-notation": null,
"declaration-block-no-redundant-longhand-properties": null
}, },
"ignoreFiles": ["components/style/color/{bezierEasing,colorPalette,tinyColor}.less"] "ignoreFiles": ["components/style/color/{bezierEasing,colorPalette,tinyColor}.less"]
} }

3
site/theme/template/Layout/Header/index.tsx

@ -32,7 +32,7 @@ export interface HeaderProps {
intl: { locale: string }; intl: { locale: string };
location: { pathname: string; query: any }; location: { pathname: string; query: any };
router: any; router: any;
themeConfig?: { docVersions: Record<string, string> }; themeConfig?: { docVersions: Record<string, string>; docNewVersions: Record<string, string> };
changeDirection: (direction: DirectionType) => void; changeDirection: (direction: DirectionType) => void;
} }
@ -208,6 +208,7 @@ const Header: React.FC<HeaderProps & WrappedComponentProps<'intl'>> = (props) =>
{({ isMobile }) => { {({ isMobile }) => {
const { menuVisible, windowWidth, searching, showTechUIButton } = headerState; const { menuVisible, windowWidth, searching, showTechUIButton } = headerState;
const docVersions: Record<string, string> = { const docVersions: Record<string, string> = {
...themeConfig?.docNewVersions,
[antdVersion]: antdVersion, [antdVersion]: antdVersion,
...themeConfig?.docVersions, ...themeConfig?.docVersions,
}; };

7
site/themeConfig.js

@ -1,3 +1,6 @@
const chineseMirror =
typeof location !== 'undefined' && location.hostname.includes('.antgroup.com');
module.exports = { module.exports = {
categoryOrder: { categoryOrder: {
'Ant Design': 0, 'Ant Design': 0,
@ -43,7 +46,6 @@ module.exports = {
'Template Document': 3, 'Template Document': 3,
}, },
docVersions: { docVersions: {
'5.x': 'https://ant.design',
'3.x': 'http://3x.ant.design', '3.x': 'http://3x.ant.design',
'2.x': 'http://2x.ant.design', '2.x': 'http://2x.ant.design',
'1.x': 'http://1x.ant.design', '1.x': 'http://1x.ant.design',
@ -52,4 +54,7 @@ module.exports = {
'0.10.x': 'http://010x.ant.design', '0.10.x': 'http://010x.ant.design',
'0.9.x': 'http://09x.ant.design', '0.9.x': 'http://09x.ant.design',
}, },
docNewVersions: {
'5.x': chineseMirror ? 'https://ant-design.antgroup.com' : 'https://ant.design',
},
}; };

Loading…
Cancel
Save