From 729f56872379615fa12d3656852eb268b81b36c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=9E=AB?= <7971419+crazyair@users.noreply.github.com> Date: Fri, 26 May 2023 23:18:50 +0800 Subject: [PATCH] docs: tweak version select option order (#42564) * feat: test * chore: empty --------- Co-authored-by: afc163 --- .stylelintrc.json | 3 ++- site/theme/template/Layout/Header/index.tsx | 3 ++- site/themeConfig.js | 7 ++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.stylelintrc.json b/.stylelintrc.json index 81a0a2c283..3d26036ccd 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -39,7 +39,8 @@ "color-function-notation": "legacy", "selector-class-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"] } diff --git a/site/theme/template/Layout/Header/index.tsx b/site/theme/template/Layout/Header/index.tsx index efa7b89978..052eb01b56 100644 --- a/site/theme/template/Layout/Header/index.tsx +++ b/site/theme/template/Layout/Header/index.tsx @@ -32,7 +32,7 @@ export interface HeaderProps { intl: { locale: string }; location: { pathname: string; query: any }; router: any; - themeConfig?: { docVersions: Record }; + themeConfig?: { docVersions: Record; docNewVersions: Record }; changeDirection: (direction: DirectionType) => void; } @@ -208,6 +208,7 @@ const Header: React.FC> = (props) => {({ isMobile }) => { const { menuVisible, windowWidth, searching, showTechUIButton } = headerState; const docVersions: Record = { + ...themeConfig?.docNewVersions, [antdVersion]: antdVersion, ...themeConfig?.docVersions, }; diff --git a/site/themeConfig.js b/site/themeConfig.js index 5e05639bc7..08376ecd4e 100644 --- a/site/themeConfig.js +++ b/site/themeConfig.js @@ -1,3 +1,6 @@ +const chineseMirror = + typeof location !== 'undefined' && location.hostname.includes('.antgroup.com'); + module.exports = { categoryOrder: { 'Ant Design': 0, @@ -43,7 +46,6 @@ module.exports = { 'Template Document': 3, }, docVersions: { - '5.x': 'https://ant.design', '3.x': 'http://3x.ant.design', '2.x': 'http://2x.ant.design', '1.x': 'http://1x.ant.design', @@ -52,4 +54,7 @@ module.exports = { '0.10.x': 'http://010x.ant.design', '0.9.x': 'http://09x.ant.design', }, + docNewVersions: { + '5.x': chineseMirror ? 'https://ant-design.antgroup.com' : 'https://ant.design', + }, };