Skip to content

Commit

Permalink
feat(module:divider): support nzPlain property
Browse files Browse the repository at this point in the history
  • Loading branch information
vthinkxie committed Jul 14, 2020
1 parent 1a408ee commit d5232ac
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 1 deletion.
1 change: 1 addition & 0 deletions components/divider/demo/horizontal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { Component } from '@angular/core';
<nz-divider nzDashed [nzText]="text">
<ng-template #text><i nz-icon nzType="plus"></i> Add</ng-template>
</nz-divider>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert
tamen, quo modo.
Expand Down
3 changes: 2 additions & 1 deletion components/divider/demo/module
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { NzDividerModule } from 'ng-zorro-antd/divider';
import { NzIconModule } from 'ng-zorro-antd/icon';

export const moduleList = [ NzDividerModule ];
export const moduleList = [ NzDividerModule, NzIconModule ];
9 changes: 9 additions & 0 deletions components/divider/demo/orientation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ import { Component } from '@angular/core';
selector: 'nz-demo-divider-orientation',
template: `
<div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert
tamen, quo modo.
</p>
<nz-divider nzText="Text"></nz-divider>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert
tamen, quo modo.
</p>
<nz-divider nzText="Left Text" nzOrientation="left"></nz-divider>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert
Expand Down
14 changes: 14 additions & 0 deletions components/divider/demo/plain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
order: 3
title:
zh-CN: 分割文字使用正文样式
en-US: Text without heading style
---

## zh-CN

使用 `nzPlain` 可以设置为更轻量的分割文字样式。

## en-US

You can use non-heading style of divider text by setting `nzPlain`.
29 changes: 29 additions & 0 deletions components/divider/demo/plain.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Component } from '@angular/core';

@Component({
selector: 'nz-demo-divider-plain',
template: `
<div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert
tamen, quo modo.
</p>
<nz-divider nzPlain nzText="Text"></nz-divider>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert
tamen, quo modo.
</p>
<nz-divider nzPlain nzText="Left Text" nzOrientation="left"></nz-divider>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert
tamen, quo modo.
</p>
<nz-divider nzPlain nzText="Right Text" nzOrientation="right"></nz-divider>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert
tamen, quo modo.
</p>
</div>
`
})
export class NzDemoDividerPlainComponent {}
4 changes: 4 additions & 0 deletions components/divider/divider.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import { InputBoolean } from 'ng-zorro-antd/core/util';
'[class.ant-divider]': 'true',
'[class.ant-divider-horizontal]': `nzType === 'horizontal'`,
'[class.ant-divider-vertical]': `nzType === 'vertical'`,
'[class.ant-divider-with-text]': `nzText`,
'[class.ant-divider-plain]': `nzPlain`,
'[class.ant-divider-with-text-left]': `nzText && nzOrientation === 'left'`,
'[class.ant-divider-with-text-right]': `nzText && nzOrientation === 'right'`,
'[class.ant-divider-with-text-center]': `nzText && nzOrientation === 'center'`,
Expand All @@ -31,9 +33,11 @@ import { InputBoolean } from 'ng-zorro-antd/core/util';
})
export class NzDividerComponent {
static ngAcceptInputType_nzDashed: BooleanInput;
static ngAcceptInputType_nzPlain: BooleanInput;

@Input() nzText?: string | TemplateRef<void>;
@Input() nzType: 'horizontal' | 'vertical' = 'horizontal';
@Input() nzOrientation: 'left' | 'right' | 'center' = 'center';
@Input() @InputBoolean() nzDashed = false;
@Input() @InputBoolean() nzPlain = false;
}
1 change: 1 addition & 0 deletions components/divider/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ import { NzDividerModule } from 'ng-zorro-antd/divider';
| `[nzDashed]` | whether line is dasded | `boolean` | `false` |
| `[nzType]` | direction type of divider | `'horizontal' \| 'vertical'` | `'horizontal'` |
| `[nzText]` | inner text of divider | `string \| TemplateRef<void>` | - |
| `[nzPlain]` | Divider text show as plain style | `boolean` | `false` |
| `[nzOrientation]` | inner text orientation | `'center' \| 'left' \| 'right'` | `'center'` |
1 change: 1 addition & 0 deletions components/divider/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ import { NzDividerModule } from 'ng-zorro-antd/divider';
| `[nzDashed]` | 是否虚线 | `boolean` | `false` |
| `[nzType]` | 水平还是垂直类型 | `'horizontal' \| 'vertical'` | `'horizontal'` |
| `[nzText]` | 中间文字 | `string \| TemplateRef<void>` | - |
| `[nzPlain]` | 文字是否显示为普通正文样式 | `boolean` | `false` |
| `[nzOrientation]` | 中间文字方向 | `'center' \| 'left' \| 'right'` | `'center'` |

0 comments on commit d5232ac

Please sign in to comment.