Skip to content

Commit dab4d66

Browse files
authored
feat(module:float-button): add float-button component (#7884)
1 parent 3a5ba37 commit dab4d66

38 files changed

Lines changed: 1831 additions & 2 deletions

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ components/water-mark/** @OriginRing
7373
components/color-picker/** @OriginRing
7474
components/hash-code/** @OriginRing
7575
components/flex/** @ParsaArvanehPA
76+
components/float-button/** @OriginRing
7677

7778
# The `components/core/*` owners
7879
components/core/config/** @simplejason

components/back-top/doc/index.en-US.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ title: BackTop
55
cover: https://gw.alipayobjects.com/zos/alicdn/tJZ5jbTwX/BackTop.svg
66
---
77

8+
* Note: This component will be removed later. Please use `<nz-float-button-top></nz-float-button-top>` in the FloatButton component.
9+
810
`nz-back-top` makes it easy to go back to the top of the page.
911

1012
## When To Use

components/back-top/doc/index.zh-CN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ title: BackTop
66
cover: https://gw.alipayobjects.com/zos/alicdn/tJZ5jbTwX/BackTop.svg
77
---
88

9+
* 注意:该组件将在后续移除,请前往 FloatButton 组件中使用 `<nz-float-button-top></nz-float-button-top>`
10+
911
返回页面顶部的操作按钮。
1012

1113
## 何时使用

components/components.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,4 @@
6868
@import './water-mark/style/entry.less';
6969
@import './color-picker/style/entry.less';
7070
@import './hash-code/style/entry.less';
71+
@import './float-button/style/entry.less';
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
order: 0
3+
title:
4+
zh-CN: 基本
5+
en-US: Basic
6+
---
7+
8+
## zh-CN
9+
10+
最简单的用法。
11+
12+
## en-US
13+
14+
The most basic usage.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'nz-demo-float-button-basic',
5+
template: `
6+
<div class="basic">
7+
<nz-float-button></nz-float-button>
8+
</div>
9+
`,
10+
styles: [
11+
`
12+
.basic {
13+
height: 300px;
14+
position: relative;
15+
}
16+
nz-float-button {
17+
position: absolute;
18+
}
19+
`
20+
]
21+
})
22+
export class NzDemoFloatButtonBasicComponent {}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
order: 3
3+
title:
4+
zh-CN: 描述
5+
en-US: Description
6+
---
7+
8+
## zh-CN
9+
10+
可以通过 `nzDescription` 设置文字内容。
11+
12+
> 仅当 `shape` 属性为 `square` 时支持。由于空间较小,推荐使用比较精简的双数文字。
13+
14+
## en-US
15+
16+
Setting `nzDescription` prop to show FloatButton with description.
17+
18+
> supported only when `shape` is `square`. Due to narrow space for text, short sentence is recommended.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'nz-demo-float-button-description',
5+
template: `
6+
<div class="description">
7+
<nz-float-button
8+
[nzIcon]="icon"
9+
[nzDescription]="description"
10+
nzShape="square"
11+
style="right: 24px"
12+
></nz-float-button>
13+
<nz-float-button [nzDescription]="description" nzShape="square" style="right: 94px"></nz-float-button>
14+
</div>
15+
<ng-template #description>HELP</ng-template>
16+
17+
<ng-template #icon>
18+
<span nz-icon nzType="file-text" nzTheme="outline"></span>
19+
</ng-template>
20+
`,
21+
styles: [
22+
`
23+
.description {
24+
height: 300px;
25+
position: relative;
26+
}
27+
nz-float-button {
28+
position: absolute;
29+
}
30+
`
31+
]
32+
})
33+
export class NzDemoFloatButtonDescriptionComponent {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
order: 5
3+
title:
4+
zh-CN: 菜单模式
5+
en-US: Menu mode
6+
---
7+
8+
## zh-CN
9+
10+
设置 `nzTrigger` 属性即可开启菜单模式。提供 `hover``click` 两种触发方式。
11+
12+
## en-US
13+
14+
Open menu mode with `nzTrigger`, which could be `hover` or `click`.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'nz-demo-float-button-group-menu',
5+
template: `
6+
<div class="menu">
7+
<nz-float-button-group
8+
[nzIcon]="icon"
9+
nzType="primary"
10+
nzTrigger="click"
11+
style="right: 24px"
12+
(nzOnOpenChange)="openChange($event)"
13+
>
14+
<nz-float-button></nz-float-button>
15+
<nz-float-button [nzIcon]="inner"></nz-float-button>
16+
</nz-float-button-group>
17+
<nz-float-button-group
18+
[nzIcon]="icon"
19+
nzType="primary"
20+
nzTrigger="hover"
21+
style="right: 94px"
22+
(nzOnOpenChange)="openChange($event)"
23+
>
24+
<nz-float-button></nz-float-button>
25+
<nz-float-button [nzIcon]="inner"></nz-float-button>
26+
</nz-float-button-group>
27+
</div>
28+
<ng-template #icon>
29+
<span nz-icon nzType="customer-service" nzTheme="outline"></span>
30+
</ng-template>
31+
<ng-template #inner>
32+
<span nz-icon nzType="comment" nzTheme="outline"></span>
33+
</ng-template>
34+
`,
35+
styles: [
36+
`
37+
.menu {
38+
height: 300px;
39+
position: relative;
40+
}
41+
nz-float-button-group,
42+
nz-float-button {
43+
position: absolute;
44+
}
45+
`
46+
]
47+
})
48+
export class NzDemoFloatButtonGroupMenuComponent {
49+
openChange(status: boolean): void {
50+
console.log(status);
51+
}
52+
}

0 commit comments

Comments
 (0)