From bfa8aaec5e5ce48373acc9db886b579507199096 Mon Sep 17 00:00:00 2001 From: Chang Wei Date: Tue, 5 Jul 2022 01:37:50 -0700 Subject: [PATCH] feat: Space support align stretch (#36310) * feat/Space-component-support-align-stretch: support align to stretch Signed-off-by: Chang Wei * feat/Space-component-support-align-stretch: update document of zh-CN and en-US Signed-off-by: Chang Wei * feat/Space-component-support-align-stretch: update demo Signed-off-by: Chang Wei * feat/Space-component-support-align-stretch: update snapshot by command `npm test -- components/space -u` Signed-off-by: Chang Wei --- .../__snapshots__/demo-extend.test.ts.snap | 36 +++++++++++++++++++ .../__tests__/__snapshots__/demo.test.js.snap | 36 +++++++++++++++++++ components/space/demo/align.md | 7 ++++ components/space/index.en-US.md | 2 +- components/space/index.tsx | 2 +- components/space/index.zh-CN.md | 2 +- components/space/style/index.less | 4 +++ 7 files changed, 86 insertions(+), 3 deletions(-) diff --git a/components/space/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/space/__tests__/__snapshots__/demo-extend.test.ts.snap index be1acfb350c3..d5722d89ff57 100644 --- a/components/space/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/space/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -148,6 +148,42 @@ exports[`renders ./components/space/demo/align.md extend context correctly 1`] = +
+
+
+ stretch +
+
+ +
+
+ + Block + +
+
+
`; diff --git a/components/space/__tests__/__snapshots__/demo.test.js.snap b/components/space/__tests__/__snapshots__/demo.test.js.snap index 9634bca1a599..6a4d6518143d 100644 --- a/components/space/__tests__/__snapshots__/demo.test.js.snap +++ b/components/space/__tests__/__snapshots__/demo.test.js.snap @@ -148,6 +148,42 @@ exports[`renders ./components/space/demo/align.md correctly 1`] = ` +
+
+
+ stretch +
+
+ +
+
+ + Block + +
+
+
`; diff --git a/components/space/demo/align.md b/components/space/demo/align.md index e9c421cc0bb9..6c7b7e87f46e 100644 --- a/components/space/demo/align.md +++ b/components/space/demo/align.md @@ -47,6 +47,13 @@ const App: React.FC = () => ( Block +
+ + stretch + + Block + +
); diff --git a/components/space/index.en-US.md b/components/space/index.en-US.md index 2a2e6f126429..3126a44b443d 100644 --- a/components/space/index.en-US.md +++ b/components/space/index.en-US.md @@ -16,7 +16,7 @@ Avoid components clinging together and set a unified space. | Property | Description | Type | Default | Version | | --- | --- | --- | --- | --- | -| align | Align items | `start` \| `end` \|`center` \|`baseline` | - | 4.2.0 | +| align | Align items | `start` \| `end` \|`center` \|`baseline` \|`stretch` | - | 4.2.0 | | direction | The space direction | `vertical` \| `horizontal` | `horizontal` | 4.1.0 | | size | The space size | [Size](#Size) \| [Size\[\]](#Size) | `small` | 4.1.0 \| Array: 4.9.0 | | split | Set split | ReactNode | - | 4.7.0 | diff --git a/components/space/index.tsx b/components/space/index.tsx index 249a5ba4e44e..a6e6a278c6a4 100644 --- a/components/space/index.tsx +++ b/components/space/index.tsx @@ -22,7 +22,7 @@ export interface SpaceProps extends React.HTMLAttributes { size?: SpaceSize | [SpaceSize, SpaceSize]; direction?: 'horizontal' | 'vertical'; // No `stretch` since many components do not support that. - align?: 'start' | 'end' | 'center' | 'baseline'; + align?: 'start' | 'end' | 'center' | 'baseline' | 'stretch'; split?: React.ReactNode; wrap?: boolean; } diff --git a/components/space/index.zh-CN.md b/components/space/index.zh-CN.md index 0dc81f9690a0..1795afb66039 100644 --- a/components/space/index.zh-CN.md +++ b/components/space/index.zh-CN.md @@ -20,7 +20,7 @@ cover: https://gw.alipayobjects.com/zos/antfincdn/wc6%263gJ0Y8/Space.svg | 参数 | 说明 | 类型 | 默认值 | 版本 | | --- | --- | --- | --- | --- | -| align | 对齐方式 | `start` \| `end` \|`center` \|`baseline` | - | 4.2.0 | +| align | 对齐方式 | `start` \| `end` \|`center` \|`baseline` \|`stretch` | - | 4.2.0 | | direction | 间距方向 | `vertical` \| `horizontal` | `horizontal` | 4.1.0 | | size | 间距大小 | [Size](#Size) \| [Size\[\]](#Size) | `small` | 4.1.0 \| Array: 4.9.0 | | split | 设置拆分 | ReactNode | - | 4.7.0 | diff --git a/components/space/style/index.less b/components/space/style/index.less index 842554ca278c..f9301a7990dd 100644 --- a/components/space/style/index.less +++ b/components/space/style/index.less @@ -27,6 +27,10 @@ &-baseline { align-items: baseline; } + + &-stretch { + align-items: stretch; + } } }