- {!isGuide &&
-
}
+ )}
@@ -120,7 +128,9 @@ const Content = () => {
})}
-
+ {!isGuide && (
+
+ )}
)
}
diff --git a/src/sites/doc/components/nav/nav.tsx b/src/sites/doc/components/nav/nav.tsx
index 88d3a2b061..3ddfbfe6a1 100644
--- a/src/sites/doc/components/nav/nav.tsx
+++ b/src/sites/doc/components/nav/nav.tsx
@@ -35,7 +35,7 @@ const Nav = () => {
const changeNav = (_nav: any) => {
setActiveName(_nav.name)
- navigate(`${isZh ? '/zh-CN/' : '/en-US/'}guide${isTaro? '-taro' : ''}/${_nav.name.toLowerCase()}`)
+ navigate(`${isZh ? '/zh-CN/' : '/en-US/'}guide/${_nav.name.toLowerCase()}${isTaro? '-taro' : ''}`)
}
const isTaro = location.pathname.includes('-taro')
const isZh = lang === 'zh-CN'
diff --git a/src/sites/doc/docs/react/intro-react.en-US.md b/src/sites/doc/docs/react/intro-react.en-US.md
index 9bcccc2eae..ca1a178d13 100644
--- a/src/sites/doc/docs/react/intro-react.en-US.md
+++ b/src/sites/doc/docs/react/intro-react.en-US.md
@@ -4,7 +4,7 @@ The NutUI-React component library is suitable for H5 applications of the React t
## Features
-- 🚀 70+ high-quality components covering mainstream mobile scenarios
+- 🚀 80+ high-quality components covering mainstream mobile scenarios
- 📖 Based on JD APP 10.0 visual specification
- 🍭 Support on-demand reference
- 📖 Detailed documentation and examples
@@ -34,7 +34,7 @@ For browsers that do not support CSS variables, it is recommended to use [postcs
Thanks to the following friends for their contributions to NutUI-React:
-
+
## LICENSE
diff --git a/src/sites/doc/docs/react/intro-react.md b/src/sites/doc/docs/react/intro-react.md
index eea1cf0f3a..6f12688d62 100644
--- a/src/sites/doc/docs/react/intro-react.md
+++ b/src/sites/doc/docs/react/intro-react.md
@@ -4,7 +4,7 @@ NutUI-React 组件库,适用于 React 技术栈的 H5 应用,开箱即用,
## 特性
-- 🚀 70+ 高质量组件,覆盖移动端主流场景
+- 🚀 80+ 高质量组件,覆盖移动端主流场景
- 📖 基于京东APP 10.0 视觉规范
- 🍭 支持按需引用
- 📖 详尽的文档和示例
diff --git a/src/sites/doc/docs/react/migrate-from-v1.en-US.md b/src/sites/doc/docs/react/migrate-from-v1.en-US.md
new file mode 100644
index 0000000000..ac547cc7d1
--- /dev/null
+++ b/src/sites/doc/docs/react/migrate-from-v1.en-US.md
@@ -0,0 +1,73 @@
+# Upgrading from v1 to v2
+
+This document will help you upgrade from NutUI React `1.x` to NutUI React `2.x` version.
+
+## Upgrade Steps
+
+1. H5 Install NutUI React version 2.x
+
+```shell
+npm install @nutui/nutui-react
+```
+
+2. Taro installs NutUI React version 2.x
+
+```shell
+npm install @nutui/nutui-react-taro
+```
+
+3. Handling incompatible updates
+ There are some incompatible updates from NutUI React 1.x to NutUI React 2.x. You need to read the incompatible updates carefully and deal with them in turn.
+ You can manually check your code against the list below to make changes, or we provide a codemod cli tool @nutui/nutui-react-codemod to help you upgrade to v2 quickly. Please commit your local code changes before running codemod cli.
+4. Theme variables are renamed:
+ For example, primary-color is renamed to color-primary; note that if you are using a custom theme, especially if you are using the ConfigProvider component, you are not using `nutuiBrandColor`, remember to rename it to `nutuiColorPrimary`.
+
+## Compatibility Updates
+
+1. Component style handling
+ Added support for importing css files on demand, while retaining the ability to import scss files on demand. On-demand css import can be realized by babel-import-plugin plugin:
+ The H5 configuration is as follows:
+
+```json
+// Webpack .babelrc or babel.config.js configuration
+plugins: [
+ [
+ “import”.
+ {
+ libraryName: “@nutui/nutui-react”, libraryDirectory: “dist/esm”, {
+ libraryDirectory: “dist/esm”, {
+ style: 'css',
+ camel2DashComponentName: false,
+ }.
+ “nutui-react”.
+ ]
+]
+```
+
+Taro is configured as follows:
+
+```json
+// Configured in Webpack .babelrc or babel.config.js
+plugins: [
+ [
+ “import”.
+ {
+ libraryName: “@nutui/nutui-react-taro”, libraryDirectory: “dist/esm”, {
+ libraryDirectory: “dist/esm”, {
+ style: 'css',
+ camel2DashComponentName: false,
+ }.
+ “nutui-react-taro”.
+ ]
+]
+```
+
+2. better type exporting and adding `JSDoc` annotations to types
+3. Adjustment of component categorization
+ In terms of component classification, we have reviewed the 1.x classification based on the information structure from the interaction dimension, together with the interaction design side, and subclassed and reclassified them, with the goal of more closely matching the distribution of interaction scenarios and making it easy to find components. The main distribution is:
+
+- Basic components, remove the `Popup` component, and subdivide `Popup` into operation feedback-guidance tips section;
+- Layout components, remain unchanged;
+- Navigation components: move paging related components `Pagination` and `Indicator` to the display component (to consider the light operation of paging on mobile); move `Menu` menu to the subclass of data entry class-selector (to consider that `Menu` is mainly used as a filter);
+
+Translated with DeepL.com (free version)
diff --git a/src/sites/doc/docs/react/migrate-from-v2.en-US.md b/src/sites/doc/docs/react/migrate-from-v2.en-US.md
new file mode 100644
index 0000000000..ab97f5b9f9
--- /dev/null
+++ b/src/sites/doc/docs/react/migrate-from-v2.en-US.md
@@ -0,0 +1,78 @@
+# Upgrading from v2 to v3
+
+This document will help you upgrade from NutUI React `2.x` to NutUI React `3.x` version.
+
+## Upgrade Steps
+
+1. H5 Install NutUI React version 3.x
+
+```shell
+npm install @nutui/nutui-react
+```
+
+2. Taro installs NutUI React version 3.x
+
+```shell
+npm install @nutui/nutui-react-taro
+```
+
+3. Handling incompatible updates
+
+There are some incompatible updates from NutUI React 1.x to NutUI React 2.x. You need to read the incompatible updates carefully and deal with them in turn.
+
+You can manually check your code against the list below to make changes, or we provide a codemod cli tool @nutui/nutui-react-codemod to help you upgrade to v2 quickly. Please commit your local code changes before running codemod cli.
+
+4. Theme variables are renamed:
+ For example, primary-color is renamed to color-primary; note that if you are using a custom theme, especially if you are using the ConfigProvider component, you are not using `nutuiBrandColor`, remember to rename it to `nutuiColorPrimary`.
+
+## Compatibility Updates
+
+1. Component style handling
+
+Added support for importing css files on demand, while retaining the ability to import scss files on demand. On-demand css import can be realized by babel-import-plugin plugin:
+
+The H5 configuration is as follows:
+
+```js
+// Webpack .babelrc or babel.config.js configuration
+plugins: [
+ [
+ “import”.
+ {
+ libraryName: “@nutui/nutui-react”, libraryDirectory: “dist/esm”, {
+ libraryDirectory: “dist/esm”, {
+ style: 'css',
+ camel2DashComponentName: false,
+ }.
+ “nutui-react”.
+ ]
+]
+```
+
+Taro is configured as follows:
+
+```json
+// Configured in Webpack .babelrc or babel.config.js
+plugins: [
+ [
+ “import”.
+ {
+ libraryName: “@nutui/nutui-react-taro”, libraryDirectory: “dist/esm”, {
+ libraryDirectory: “dist/esm”, {
+ style: 'css',
+ camel2DashComponentName: false,
+ }.
+ “nutui-react-taro”.
+ ]
+]
+```
+
+2. better type exporting and adding `JSDoc` annotations to types
+3. Adjustment of component categorization
+ In terms of component classification, we have reviewed the 1.x classification based on the information structure from the interaction dimension, together with the interaction design side, and subclassed and reclassified them, with the goal of more closely matching the distribution of interaction scenarios and making it easy to find components. The main distribution is:
+
+- Basic components, remove the `Popup` component, and subdivide `Popup` into operation feedback-guidance tips section;
+- Layout components, remain unchanged;
+- Navigation components: move `Pagination` and `Indicator` to the display component (considering the light operation of paging on mobile); move `Menu` menu to the data entry class-selector subclass (considering the light operation of paging on mobile); move `Menu` to the data entry class-selector subclass (considering the light operation of paging on mobile).
+
+Translated with DeepL.com (free version)
diff --git a/src/sites/doc/docs/taro/intro-react.md b/src/sites/doc/docs/taro/intro-react.md
index f862e45e9a..a1caceb7b9 100644
--- a/src/sites/doc/docs/taro/intro-react.md
+++ b/src/sites/doc/docs/taro/intro-react.md
@@ -4,7 +4,7 @@ NutUI-React 组件库,基于 Taro,使用 React 技术栈开发小程序应
## 特性
-- 🚀 70+ 高质量组件,覆盖移动端主流场景
+- 🚀 80+ 高质量组件,覆盖移动端主流场景
- 💪 支持一套代码同时开发多端小程序+H5
- 📖 基于京东APP 10.0 视觉规范
- 🍭 支持按需引用
@@ -31,7 +31,7 @@ NutUI-React 组件库,基于 Taro,使用 React 技术栈开发小程序应
感谢以下小伙伴们为 NutUI-React 发展做出的贡献:
-
+
## 开源协议
diff --git a/src/sites/doc/docs/taro/official-theme-react.md b/src/sites/doc/docs/taro/official-theme-react.md
index c4107d8c8c..b183ada3bd 100644
--- a/src/sites/doc/docs/taro/official-theme-react.md
+++ b/src/sites/doc/docs/taro/official-theme-react.md
@@ -11,7 +11,7 @@ NutUI 默认提供多套官方`UI`主题,同时允许在一定程度上定制
| 京东 APP 主题(默认) | `variables.scss` |
| 京东B商城主题
预览 | `variables-jdb.scss` |
-
+
## 使用方式
diff --git a/src/sites/doc/router.ts b/src/sites/doc/router.ts
index 89d14b6518..f37724055e 100644
--- a/src/sites/doc/router.ts
+++ b/src/sites/doc/router.ts
@@ -70,7 +70,7 @@ const modulesTaroDocs = import.meta.glob('/src/sites/doc/docs/taro/*.md');
for (const path in modulesTaroDocs) {
let name = (/docs\/taro\/(.*).md/.exec(path) as any[])[1];
guideTaroRoutes.push({
- path: `/zh-CN/guide-taro/${name}`,
+ path: `/zh-CN/guide/${name}-taro`,
component: modulesTaroDocs[path],
name
});
@@ -79,7 +79,7 @@ const modulesEnTaroDocs = import.meta.glob('/src/sites/doc/docs/taro/*.en-US.md'
for (const path in modulesEnTaroDocs) {
let name = (/docs\/taro\/(.*).en-US.md/.exec(path) as any[])[1];
guideEnTaroRoutes.push({
- path: `/en-US/guide-taro/${name}`,
+ path: `/en-US/guide/${name}-taro`,
component: modulesEnTaroDocs[path],
name
});
From 745ba0918fb8cd14710b9cdfc5d8fabfb4646a83 Mon Sep 17 00:00:00 2001
From: "Alex.hxy" <1872591453@qq.com>
Date: Wed, 22 Jan 2025 10:20:04 +0800
Subject: [PATCH 11/14] =?UTF-8?q?fix:=20=E9=87=8D=E7=BD=AENav=20Tab?=
=?UTF-8?q?=E5=88=B7=E6=96=B0=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/sites/doc/components/nav/nav.tsx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/sites/doc/components/nav/nav.tsx b/src/sites/doc/components/nav/nav.tsx
index 3ddfbfe6a1..ce4d35d5cf 100644
--- a/src/sites/doc/components/nav/nav.tsx
+++ b/src/sites/doc/components/nav/nav.tsx
@@ -31,10 +31,13 @@ const Nav = () => {
} else {
setIsGuide(false)
}
+ if(location.pathname.includes('/intro-react')) {
+ setActiveName('intro-react')
+ }
}, [location])
const changeNav = (_nav: any) => {
setActiveName(_nav.name)
-
+ console.log(_nav.name)
navigate(`${isZh ? '/zh-CN/' : '/en-US/'}guide/${_nav.name.toLowerCase()}${isTaro? '-taro' : ''}`)
}
const isTaro = location.pathname.includes('-taro')
From d4624ced21d55f30207e376e2a00d2925fa2cee3 Mon Sep 17 00:00:00 2001
From: "Alex.hxy" <1872591453@qq.com>
Date: Wed, 22 Jan 2025 10:25:00 +0800
Subject: [PATCH 12/14] chore: delete some logs
---
src/sites/doc/App.tsx | 1 -
src/sites/doc/components/header/header.tsx | 3 ---
src/sites/doc/components/nav/nav.tsx | 1 -
3 files changed, 5 deletions(-)
diff --git a/src/sites/doc/App.tsx b/src/sites/doc/App.tsx
index 0e92f54a6d..2cbc4edc02 100644
--- a/src/sites/doc/App.tsx
+++ b/src/sites/doc/App.tsx
@@ -92,7 +92,6 @@ const Content = () => {
...guideTaroRoutes,
...guideEnTaroRoutes,
]
- console.log(guideRoutes, guideTaroRoutes)
return (
{!isGuide && (
diff --git a/src/sites/doc/components/header/header.tsx b/src/sites/doc/components/header/header.tsx
index 41e0116504..a0bce3b0ad 100644
--- a/src/sites/doc/components/header/header.tsx
+++ b/src/sites/doc/components/header/header.tsx
@@ -66,9 +66,7 @@ const Header = () => {
(l) => location.pathname.indexOf(l.locale) > -1
)[0]
setCurrLang(lang)
- console.log(lang)
}, [location])
- const [visible, setVisible] = useState(false)
const [activeLink, setActiveLink] = useState('指南')
// const handleSwitchLocale = (e: any) => {
// const classList: string[] = [].slice.call(e.target.classList)
@@ -158,7 +156,6 @@ const Header = () => {
>
{
- console.log(item)
toLink(item)
}}
>
diff --git a/src/sites/doc/components/nav/nav.tsx b/src/sites/doc/components/nav/nav.tsx
index ce4d35d5cf..ed4c1efd4d 100644
--- a/src/sites/doc/components/nav/nav.tsx
+++ b/src/sites/doc/components/nav/nav.tsx
@@ -37,7 +37,6 @@ const Nav = () => {
}, [location])
const changeNav = (_nav: any) => {
setActiveName(_nav.name)
- console.log(_nav.name)
navigate(`${isZh ? '/zh-CN/' : '/en-US/'}guide/${_nav.name.toLowerCase()}${isTaro? '-taro' : ''}`)
}
const isTaro = location.pathname.includes('-taro')
From 3a8ad9b40421db092900e6751c167f5b3c89b1f6 Mon Sep 17 00:00:00 2001
From: "Alex.hxy" <1872591453@qq.com>
Date: Wed, 22 Jan 2025 11:35:20 +0800
Subject: [PATCH 13/14] feat: save some backtop logics
---
src/sites/assets/styles/md-style.scss | 1 -
src/sites/assets/styles/variables.scss | 49 +++++++++++++------
src/sites/doc/App.scss | 5 ++
src/sites/doc/App.tsx | 6 ++-
.../doc/components/demoblock/codeblock.tsx | 3 +-
5 files changed, 46 insertions(+), 18 deletions(-)
diff --git a/src/sites/assets/styles/md-style.scss b/src/sites/assets/styles/md-style.scss
index 2578487490..f6e4995484 100644
--- a/src/sites/assets/styles/md-style.scss
+++ b/src/sites/assets/styles/md-style.scss
@@ -1,5 +1,4 @@
@import 'highlight.scss';
-$doc-smile-curve: url('https://img10.360buyimg.com/imagetools/jfs/t1/136135/19/14659/946/5fa20aa8E33a9aa26/d329fbe669171208.png') !default;
.doc-content-document {
position: relative;
diff --git a/src/sites/assets/styles/variables.scss b/src/sites/assets/styles/variables.scss
index fc6b3a5203..1ff4609e4c 100644
--- a/src/sites/assets/styles/variables.scss
+++ b/src/sites/assets/styles/variables.scss
@@ -1,5 +1,8 @@
// doc
-$doc-default-color: #ff0f23;
+$doc-default-color: #fa2c19 !default;
+$doc-smile-curve: url('https://img10.360buyimg.com/imagetools/jfs/t1/136135/19/14659/946/5fa20aa8E33a9aa26/d329fbe669171208.png') !default;
+$doc-footer-theme-icon: url('@/assets/images/icon-color.png') no-repeat
+ center/100% !default;
$doc-default-primary-bg: linear-gradient(
135deg,
rgba(250, 25, 44, 1) 0%,
@@ -8,9 +11,14 @@ $doc-default-primary-bg: linear-gradient(
rgba(250, 63, 25, 1) 100%
);
-// color
+$white: #fff;
+$black: #000;
+// 标题常规文字
+$title-color: #1a1a1a;
+
+// clolr
// 红色
-$theme-red: #ff0f23;
+$theme-red: #fa2c19;
$theme-red-word: #fff;
$theme-red-border: #fff;
$theme-red-input: #fff;
@@ -18,7 +26,7 @@ $theme-red-actice: #fff;
$theme-red-select-border: #f0f2f5;
$theme-red-select-word: #666;
$theme-red-select-bg: #fff;
-$theme-red-header-bg: url('../../assets/images/header-bg.png');
+$theme-red-header-bg: url('@/assets/images/header-bg.png');
$theme-red-footer-word1: #1a1a1a;
$theme-red-footer-word2: #666;
$theme-red-footer-word3: #1d1d21;
@@ -37,22 +45,24 @@ $theme-white: #fff;
$theme-white-word: #1a1a1a;
$theme-white-input: #ccc;
$theme-white-border: #d8d8d8;
-$theme-white-actice: #ff0f23;
+$theme-white-actice: #fa2c19;
$theme-white-select-border: #f0f2f5;
$theme-white-select-word: #666;
$theme-white-select-bg: #fff;
+$theme-white-select-hover: rgba(0, 0, 0, 0.02);
+$theme-white-select-active: rgba(0, 0, 0, 0.06);
$theme-white-box-border: #f5f5f5;
$theme-white-footer-word1: #1a1a1a;
$theme-white-footer-word2: #666;
$theme-white-footer-word3: #1d1d21;
$theme-white-footer-word4: #808080;
-$theme-white-footer-hover: #ff0f23;
+$theme-white-footer-hover: #fa2c19;
$theme-white-footer-bg: #fff;
$theme-white-footer-border: #eaf0fb;
$theme-white-theme-border: #f5f6f7;
$theme-white-circle: #fff;
$theme-white-circle-border: #e5e5e5;
-$theme-white-index-description: #959fb1;
+$theme-white-index-desc: #959fb1;
// 黑色
$theme-black-word: #ccc;
@@ -60,6 +70,10 @@ $theme-black-input: #ccc;
$theme-black-border: #d8d8d8;
$theme-black-actice: #fff;
$theme-black-select-bg: #1d1d1d;
+$theme-black-nav-select-bg: #2c2c2c;
+$theme-black-nav-select-border: #5e5e5e;
+$theme-black-nav-select-active-bg: rgba(255, 255, 255, 0.2);
+$theme-black-nav-select-hover-bg: rgba(255, 255, 255, 0.06);
$theme-black-select-border: #c1c1c3;
$theme-black-select-hover: #797a7b;
$theme-black-select-word: #fff;
@@ -67,8 +81,8 @@ $theme-black-box-border: #6b5554;
$theme-black-footer-word1: #fff;
$theme-black-footer-word2: #f5f5f5;
$theme-black-footer-word3: #f5f5f5;
-$theme-black-footer-word4: #808080;
-$theme-black-footer-hover: #ff0f23;
+$theme-black-footer-word4: #fff;
+$theme-black-footer-hover: $doc-default-color;
$theme-black-footer-bg: #1d1d21;
$theme-black-footer-border: transparent;
$theme-black-theme-border: #666;
@@ -76,27 +90,34 @@ $theme-black-circle: #1a1a1a;
// header
$doc-default-header-color: $white;
$doc-header-height: 64px;
-$doc-header-bg: url('../../assets/images/header-bg.png') no-repeat;
+$doc-header-bg: url('@/assets/images/header-bg.png') no-repeat;
// nav
$doc-default-nav-bg: $white;
-$doc-default-nav-color: $color-title;
+$doc-default-nav-color: $title-color;
+$doc-nav-icon-color1: #41b883;
+$doc-nav-icon-color2: #74c9ff;
+$doc-nav-icon-bg1: rgba(65, 184, 131, 0.16);
+$doc-nav-icon-bg2: rgba(116, 201, 255, 0.16);
+// footer
+// $doc-default-header-color: $white;
+// $doc-footer-height: 73px;
// home
$theme-black-content-bg: #060506;
//markdown-add-style
$nutui-doc-black: #323233;
-$nutui-doc-blue: #0073ff;
+$nutui-doc-blue: #1989fa;
$nutui-doc-purple: #8080ff;
$nutui-doc-fuchsia: #a7419e;
$nutui-doc-red: #fa2400;
-$nutui-doc-text-color: #666666;
+$nutui-doc-text-color: rgba(0, 0, 0, 0.88);
$nutui-doc-text-light-blue: rgba(69, 90, 100, 0.6);
$nutui-doc-background-color: #f7f8fa;
$nutui-doc-grey: #999;
$nutui-doc-dark-grey: #666;
$nutui-doc-light-grey: #ccc;
$nutui-doc-border-color: #f1f4f8;
-$nutui-doc-code-color: #58727e;
+$nutui-doc-code-color: rgba(0, 0, 0, 0.88);
$nutui-doc-code-background-color: #f1f4f8;
$nutui-doc-code-font-family: 'Source Code Pro', 'Monaco', 'Inconsolata',
monospace;
diff --git a/src/sites/doc/App.scss b/src/sites/doc/App.scss
index 18bec29eb8..30e763cf00 100644
--- a/src/sites/doc/App.scss
+++ b/src/sites/doc/App.scss
@@ -247,3 +247,8 @@ $doc-title-height: 137px;
right: 10px;
}
}
+.doc-backtop {
+ position: fixed;
+ bottom: 14px;
+ right: 200px;
+}
diff --git a/src/sites/doc/App.tsx b/src/sites/doc/App.tsx
index 2cbc4edc02..a2be6f8ca0 100644
--- a/src/sites/doc/App.tsx
+++ b/src/sites/doc/App.tsx
@@ -128,7 +128,10 @@ const Content = () => {
{!isGuide && (
-
+ <>
+
+
+ >
)}
)
@@ -142,7 +145,6 @@ const App = () => {