-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
size.ts
55 lines (49 loc) · 1.24 KB
/
size.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { Component } from '@angular/core';
@Component({
selector: 'nz-demo-drawer-size',
template: `
<button nz-button nzType="primary" (click)="showDefault()">Open Default Size (378px)</button>
<button nz-button nzType="primary" (click)="showLarge()">Open Large Size (736px)</button>
<nz-drawer
[nzSize]="size"
[nzVisible]="visible"
nzPlacement="right"
[nzTitle]="title"
[nzExtra]="extra"
(nzOnClose)="close()"
>
<ng-container *nzDrawerContent>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
</ng-container>
</nz-drawer>
<ng-template #extra>
<button nz-button nzType="default" (click)="close()">Cancel</button>
<button nz-button nzType="primary" (click)="close()">OK</button>
</ng-template>
`
})
export class NzDemoDrawerSizeComponent {
visible = false;
size: 'large' | 'default' = 'default';
get title(): string {
return `${this.size} Drawer`;
}
showDefault(): void {
this.size = 'default';
this.open();
}
showLarge(): void {
this.size = 'large';
this.open();
}
open(): void {
this.visible = true;
}
close(): void {
this.visible = false;
}
}