-
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathcontainer.ts
More file actions
36 lines (30 loc) · 831 Bytes
/
container.ts
File metadata and controls
36 lines (30 loc) · 831 Bytes
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
import { Component, ElementRef, Input, OnInit } from '@angular/core'
import { container } from './style'
import { removeNgTag } from '../shared/utils/host'
@Component({
selector: 'el-container',
styles: [container],
template: `
<section [class]="'el-container ' + class" [class.is-vertical]="isVertical">
<ng-content></ng-content>
</section>
`,
})
export class ElContainer implements OnInit {
@Input() direction: string = ''
@Input() class: string
isVertical: boolean = false
constructor(
private el: ElementRef,
) {
}
setVertical(isVertical?: boolean): void {
if (isVertical && this.direction !== 'horizontal') {
this.isVertical = true
}
}
ngOnInit(): void {
this.isVertical = this.direction === 'vertical'
removeNgTag(this.el.nativeElement)
}
}