Skip to content

Commit

Permalink
feat(space): update demos and docs of justify and align (#1856)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-huxiyang authored Jan 12, 2024
1 parent 58996da commit 2ab3400
Show file tree
Hide file tree
Showing 6 changed files with 242 additions and 4 deletions.
19 changes: 19 additions & 0 deletions src/packages/space/demo.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,25 @@ const SpaceDemo = () => {
</Space>
</ConfigProvider>
</Cell>

<h2>主轴对齐方式</h2>

<Cell style={{ display: 'block' }}>
<Space justify="center" wrap>
<Button style={{ height: '30px' }}>{translated.button1}</Button>
<Button style={{ height: '60px' }}>{translated.button2}</Button>
<Button style={{ height: '90px' }}>{translated.button3}</Button>
</Space>
</Cell>

<h2>交叉轴对齐方式</h2>
<Cell>
<Space align="end" wrap>
<Button style={{ height: '30px' }}>{translated.button1}</Button>
<Button style={{ height: '60px' }}>{translated.button2}</Button>
<Button style={{ height: '90px' }}>{translated.button3}</Button>
</Space>
</Cell>
</div>
</>
)
Expand Down
27 changes: 27 additions & 0 deletions src/packages/space/demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ interface T extends Button {
wrap: string
direction: string
spaceGap: string
mainAxisAlign: string
crossAxisAlign: string
}
const SpaceDemo = () => {
const [translated] = useTranslate<T>({
Expand All @@ -32,6 +34,8 @@ const SpaceDemo = () => {
button4: '按钮4',
button5: '按钮5',
button6: '按钮6',
mainAxisAlign: '主轴对齐方式',
crossAxisAlign: '交叉轴对齐方式',
},
'zh-TW': {
basic: '基本用法',
Expand All @@ -44,6 +48,8 @@ const SpaceDemo = () => {
button4: '按钮4',
button5: '按钮5',
button6: '按钮6',
mainAxisAlign: '主軸對齊方式',
crossAxisAlign: '交叉軸對齊方式',
},
'en-US': {
basic: 'Basic Usage',
Expand All @@ -56,6 +62,8 @@ const SpaceDemo = () => {
button4: 'button4',
button5: 'button5',
button6: 'button6',
mainAxisAlign: 'MainAxis Alignment',
crossAxisAlign: 'CrossAxis Alignment',
},
})

Expand Down Expand Up @@ -106,6 +114,25 @@ const SpaceDemo = () => {
</Space>
</ConfigProvider>
</Cell>

<h2>{translated.mainAxisAlign}</h2>

<Cell style={{ display: 'block' }}>
<Space justify="center" wrap>
<Button style={{ height: '30px' }}>{translated.button1}</Button>
<Button style={{ height: '60px' }}>{translated.button2}</Button>
<Button style={{ height: '90px' }}>{translated.button3}</Button>
</Space>
</Cell>

<h2>{translated.crossAxisAlign}</h2>
<Cell>
<Space align="end" wrap>
<Button style={{ height: '30px' }}>{translated.button1}</Button>
<Button style={{ height: '60px' }}>{translated.button2}</Button>
<Button style={{ height: '90px' }}>{translated.button3}</Button>
</Space>
</Cell>
</div>
</>
)
Expand Down
54 changes: 52 additions & 2 deletions src/packages/space/doc.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Maintain the same width in the arrangement of elements.

## Install
## Install

```tsx
import { Space } from '@nutui/nutui-react';
Expand Down Expand Up @@ -33,7 +33,9 @@ import { Space, Button } from '@nutui/nutui-react';
export default App;

```

:::

### Wrap

:::demo
Expand All @@ -57,7 +59,9 @@ const App = () => {
export default App;

```

:::

### Direction

:::demo
Expand All @@ -78,7 +82,9 @@ const App = () => {
export default App;

```

:::

### Gap

:::demo
Expand All @@ -105,7 +111,51 @@ const App = () => {
export default App;

```

### MainAxis alignment

:::demo

```tsx
import React from 'react';
import { Space, Button } from '@nutui/nutui-react';

const App = () => {
return (
<Space justify="center" wrap>
<Button style={{ height: '30px' }}>button1</Button>
<Button style={{ height: '60px' }}>button2</Button>
<Button style={{ height: '90px' }}>button3</Button>
</Space>
);
};
export default App;

```

### CrossAxis alignment

:::demo

```tsx
import React from 'react';
import { Space, Button } from '@nutui/nutui-react';

const App = () => {
return (
<Space align="end" wrap>
<Button style={{ height: '30px' }}>button1</Button>
<Button style={{ height: '60px' }}>button2</Button>
<Button style={{ height: '90px' }}>button3</Button>
</Space>
);
};
export default App;

```

:::

## Space

### Props
Expand All @@ -126,4 +176,4 @@ to [ConfigProvider component](#/en-US/component/configprovider).

| Name | Description | Default |
| --- | --- |--------------|
| \--nutui-space-gap | `8px` | spacing size |
| \--nutui-space-gap | `8px` | spacing size |
42 changes: 42 additions & 0 deletions src/packages/space/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,48 @@ export default App;

```

### 主轴对齐方式

:::demo

```tsx
import React from 'react';
import { Space, Button } from '@nutui/nutui-react';

const App = () => {
return (
<Space justify="center" wrap>
<Button style={{ height: '30px' }}>按钮1</Button>
<Button style={{ height: '60px' }}>按钮2</Button>
<Button style={{ height: '90px' }}>按钮3</Button>
</Space>
);
};
export default App;

```

### 交叉轴对齐方式

:::demo

```tsx
import React from 'react';
import { Space, Button } from '@nutui/nutui-react';

const App = () => {
return (
<Space align="end" wrap>
<Button style={{ height: '30px' }}>按钮1</Button>
<Button style={{ height: '60px' }}>按钮2</Button>
<Button style={{ height: '90px' }}>按钮3</Button>
</Space>
);
};
export default App;

```

:::

## Space
Expand Down
52 changes: 51 additions & 1 deletion src/packages/space/doc.taro.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ import { Space, Button } from '@nutui/nutui-react-taro';
export default App;

```

:::

### 换行

:::demo
Expand All @@ -57,7 +59,9 @@ const App = () => {
export default App;

```

:::

### 垂直

:::demo
Expand All @@ -78,7 +82,9 @@ const App = () => {
export default App;

```

:::

### 间距大小

:::demo
Expand All @@ -105,7 +111,51 @@ const App = () => {
export default App;

```

### 主轴对齐方式

:::demo

```tsx
import React from 'react';
import { Space, Button } from '@nutui/nutui-react-taro';

const App = () => {
return (
<Space justify="center" wrap>
<Button style={{ height: '30px' }}>按钮1</Button>
<Button style={{ height: '60px' }}>按钮2</Button>
<Button style={{ height: '90px' }}>按钮3</Button>
</Space>
);
};
export default App;

```

### 交叉轴对齐方式

:::demo

```tsx
import React from 'react';
import { Space, Button } from '@nutui/nutui-react-taro';

const App = () => {
return (
<Space align="end" wrap>
<Button style={{ height: '30px' }}>按钮1</Button>
<Button style={{ height: '60px' }}>按钮2</Button>
<Button style={{ height: '90px' }}>按钮3</Button>
</Space>
);
};
export default App;

```

:::

## Space

### Props
Expand All @@ -125,4 +175,4 @@ export default App;

| 名称 | 默认值 | 描述 |
| --- | --- | --- |
| \--nutui-space-gap | `8px` | 间距大小 |
| \--nutui-space-gap | `8px` | 间距大小 |
Loading

0 comments on commit 2ab3400

Please sign in to comment.