From 29790915ae7cf6dc89dd82a12cae626bb7d2e27b Mon Sep 17 00:00:00 2001 From: huangchen666 <45666106+huangchen666@users.noreply.github.com> Date: Thu, 10 Feb 2022 15:58:27 +0800 Subject: [PATCH] V10 button (#1834) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ✨ 新增 `type ="icon"` 按钮类型 - ✨ 新增 `type="text"` 按钮类型 - 🦀️ 修改次级按钮样式 ## break change - 🦀️ disabled的按钮外层套了一层父元素,以支持 cursor: not-allowed #142 --- packages/zent/__tests__/button.spec.jsx | 6 - packages/zent/__tests__/disabled.spec.jsx | 4 +- packages/zent/assets/button.scss | 154 +++++++++++++++--- .../zent/assets/theme/semantic/_color.scss | 11 +- packages/zent/src/button/Directive.tsx | 11 +- packages/zent/src/button/README_en-US.md | 10 +- packages/zent/src/button/README_zh-CN.md | 11 +- packages/zent/src/button/demos/directive.md | 6 +- packages/zent/src/button/demos/disabled.md | 18 -- packages/zent/src/button/demos/group.md | 58 ------- packages/zent/src/button/demos/icon.md | 26 --- packages/zent/src/button/demos/link.md | 2 +- packages/zent/src/button/demos/loading.md | 31 ---- packages/zent/src/button/demos/no-border.md | 18 -- packages/zent/src/button/demos/size.md | 8 +- packages/zent/src/button/demos/status.md | 67 ++++++++ packages/zent/src/button/demos/style.md | 16 +- 17 files changed, 244 insertions(+), 213 deletions(-) delete mode 100644 packages/zent/src/button/demos/disabled.md delete mode 100644 packages/zent/src/button/demos/group.md delete mode 100644 packages/zent/src/button/demos/icon.md delete mode 100644 packages/zent/src/button/demos/loading.md delete mode 100644 packages/zent/src/button/demos/no-border.md create mode 100644 packages/zent/src/button/demos/status.md diff --git a/packages/zent/__tests__/button.spec.jsx b/packages/zent/__tests__/button.spec.jsx index f612bba604..18354b5a4b 100644 --- a/packages/zent/__tests__/button.spec.jsx +++ b/packages/zent/__tests__/button.spec.jsx @@ -66,12 +66,6 @@ describe(' - , mountNode -); -``` diff --git a/packages/zent/src/button/demos/group.md b/packages/zent/src/button/demos/group.md deleted file mode 100644 index a5715269e5..0000000000 --- a/packages/zent/src/button/demos/group.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -order: 9 -zh-CN: - title: Button Group - b: 加粗 - i: 斜体 - u: 下划线 - l: 左对齐 - m: 居中 - r: 右对齐 - share: 分享 - download: 下载 -en-US: - title: Button Groupe - b: B - i: I - u: U - l: L - m: M - r: R - share: Share - download: Download ---- - -```jsx -import { ButtonGroup, Button } from 'zent'; - -ReactDOM.render( -
- - - - - -
-
- - - - - -
-
- - - - - -
-
- - - - -
- , mountNode -); -``` diff --git a/packages/zent/src/button/demos/icon.md b/packages/zent/src/button/demos/icon.md deleted file mode 100644 index 98c73c0204..0000000000 --- a/packages/zent/src/button/demos/icon.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -order: 8 -zh-CN: - title: 按钮图标 - search: 搜索 - save: 保存 - nextStep: 下一步 -en-US: - title: Button Icon - search: Search - save: Save - nextStep: Next step ---- - -```jsx -import { Button, Icon } from 'zent'; - -ReactDOM.render( -
- - - -
- , mountNode -); -``` diff --git a/packages/zent/src/button/demos/link.md b/packages/zent/src/button/demos/link.md index 44306d830a..efee8e369c 100644 --- a/packages/zent/src/button/demos/link.md +++ b/packages/zent/src/button/demos/link.md @@ -1,5 +1,5 @@ --- -order: 7 +order: 10 zh-CN: title: 将按钮变成链接, 只需要提供`href`属性,并可以通过`target`属性控制打开方式 index: 有赞首页 diff --git a/packages/zent/src/button/demos/loading.md b/packages/zent/src/button/demos/loading.md deleted file mode 100644 index 609dd167b9..0000000000 --- a/packages/zent/src/button/demos/loading.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -order: 3 -zh-CN: - title: 正在加载的状态 - button1: 实心按钮 - button2: 描边按钮 - button3: 普通按钮 -en-US: - title: Loading - button1: Filled - button2: Outline - button3: Normal ---- - -```jsx -import { Button } from 'zent'; - -ReactDOM.render( -
-
- -
-
- -
-
, - mountNode -); -``` diff --git a/packages/zent/src/button/demos/no-border.md b/packages/zent/src/button/demos/no-border.md deleted file mode 100644 index 0cd3ae37ab..0000000000 --- a/packages/zent/src/button/demos/no-border.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -order: 6 -zh-CN: - title: 无边框按钮,一般在背景色比较深的地方使用,使用时要注意和背景色的对比区分。 - button: 无边框 -en-US: - title: Button without border, generally used in a darker background. Make sure the colors are different between background and button. - button: No border ---- - -```jsx -import { Button } from 'zent'; - -ReactDOM.render( - - , mountNode -); -``` diff --git a/packages/zent/src/button/demos/size.md b/packages/zent/src/button/demos/size.md index f6403f9f9b..0ed4edb4d8 100644 --- a/packages/zent/src/button/demos/size.md +++ b/packages/zent/src/button/demos/size.md @@ -1,15 +1,17 @@ --- -order: 5 +order: 6 zh-CN: title: 按钮大小 normalButton: 正常按钮 bigButton: 大号按钮 smallButton: 小号按钮 + textButton: 文字按钮 en-US: title: Button sizes normalButton: Normal bigButton: Big smallButton: Small + textButton: text --- ```jsx @@ -20,6 +22,10 @@ ReactDOM.render( + + + + , mountNode ); diff --git a/packages/zent/src/button/demos/status.md b/packages/zent/src/button/demos/status.md new file mode 100644 index 0000000000..72d0ac4969 --- /dev/null +++ b/packages/zent/src/button/demos/status.md @@ -0,0 +1,67 @@ +--- +order: 7 +zh-CN: + title: 按钮状态 + button1: 主按钮 + button3: 次按钮 + button2: 文字按钮 +en-US: + title: Loading + button1: Filled + button3: Normal + button2: text +--- + +```jsx +import { Button } from 'zent'; + +ReactDOM.render( +
+
+ + + + +
+
+ + + + +
+
+ + + +
+
+
+
, + mountNode +); +``` diff --git a/packages/zent/src/button/demos/style.md b/packages/zent/src/button/demos/style.md index 002eeb7793..77532ed44d 100644 --- a/packages/zent/src/button/demos/style.md +++ b/packages/zent/src/button/demos/style.md @@ -1,15 +1,17 @@ --- order: 2 zh-CN: - title: 风格 - button1: 实心按钮 - button2: 描边按钮 - button3: 普通按钮 + title: 按钮类型 + button1: 主按钮 + button2: 文字按钮 + button3: 次按钮 + button4: 图标按钮 en-US: title: Style button1: Filled - button2: Outline + button2: text button3: Normal + button4: icon --- ```jsx @@ -19,9 +21,9 @@ ReactDOM.render(
-
-
+ +
, mountNode