cover.component.ts 1.34 KB
Newer Older
Ooh-Ao committed
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
import { DOCUMENT } from '@angular/common';
import { Component, ElementRef, Inject, Renderer2 } from '@angular/core';

@Component({
  selector: 'app-cover',
  templateUrl: './cover.component.html',
  styleUrls: ['./cover.component.scss']
})
export class CoverComponent {
  constructor(@Inject(DOCUMENT) private document: Document,
  private elementRef: ElementRef,
  private renderer: Renderer2,) {}

  ngOnInit(): void {
    this.renderer.addClass(this.document.body, "cover1");
    this.renderer.addClass(this.document.body,"justify-center");

    const html : any = this.elementRef.nativeElement.ownerDocument.documentElement;
    html.removeAttribute('data-header-styles', 'dark');
    html.removeAttribute('data-nav-layout', 'vertical');
       html.setAttribute('data-menu-styles', 'dark');
   if (localStorage.getItem('synto-header-mode') == 'dark') {
     const html: any = this.elementRef.nativeElement.ownerDocument.documentElement;
     html.classList.add('h-full', 'dark');
   }
    
  }

  ngOnDestroy(): void {
    this.renderer.removeClass(this.document.body, "cover1");
    this.renderer.removeClass(this.document.body, "justify-center");
      if (localStorage.getItem('synto-header-mode') == 'dark') {
        const html: any = this.elementRef.nativeElement.ownerDocument.documentElement;
        html.classList.remove('h-full', 'dark');
      }

}
}