Skip to content

Commit feff47b

Browse files
committed
refactor(app-footer): drop Replace footer, cleanup
1 parent 73b1569 commit feff47b

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed
Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,33 @@
1-
import {Component, ElementRef, Inject, Input, OnDestroy, OnInit, Renderer2} from '@angular/core';
1+
import {Component, HostBinding, Inject, Input, OnDestroy, OnInit, Renderer2} from '@angular/core';
22
import {DOCUMENT} from '@angular/common';
33

4-
import {Replace} from '../shared';
5-
64
@Component({
7-
selector: 'app-footer',
8-
template: `
9-
<ng-container class="app-footer"></ng-container>
10-
<footer class="app-footer">
11-
<ng-content></ng-content>
12-
</footer>
13-
`
5+
selector: 'app-footer, cui-footer',
6+
template: `<ng-content></ng-content>`
147
})
158
export class AppFooterComponent implements OnInit, OnDestroy {
169
@Input() fixed: boolean;
1710

11+
@HostBinding('class.app-footer') true;
12+
13+
private readonly fixedClass = 'footer-fixed';
14+
1815
constructor(
1916
@Inject(DOCUMENT) private document: any,
2017
private renderer: Renderer2,
21-
private el: ElementRef
2218
) {}
2319

2420
ngOnInit(): void {
25-
Replace(this.el);
2621
this.isFixed(this.fixed);
2722
}
2823

2924
ngOnDestroy(): void {
30-
this.renderer.removeClass(this.document.body, 'footer-fixed');
25+
this.renderer.removeClass(this.document.body, this.fixedClass);
3126
}
3227

3328
isFixed(fixed: boolean = this.fixed): void {
3429
if (fixed) {
35-
this.renderer.addClass(this.document.body, 'footer-fixed');
30+
this.renderer.addClass(this.document.body, this.fixedClass);
3631
}
3732
}
3833
}

0 commit comments

Comments
 (0)