red-ui/apps/red-ui/src/app/modules/account/base-account-screen/base-account-screen-component.ts
2022-05-18 14:48:45 +03:00

28 lines
1010 B
TypeScript

import { ChangeDetectionStrategy, Component, OnInit, ViewContainerRef } from '@angular/core';
import { Router } from '@angular/router';
import { accountTranslations } from '@translations/account-translations';
@Component({
selector: 'redaction-base-account-screen',
templateUrl: './base-account-screen-component.html',
styleUrls: ['./base-account-screen-component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class BaseAccountScreenComponent implements OnInit {
readonly translations = accountTranslations;
readonly path: string;
constructor(private readonly _router: Router, private readonly _hostRef: ViewContainerRef) {
this.path = this._router.url.split('/').pop();
}
ngOnInit(): void {
this._setDialogWidth();
}
private _setDialogWidth() {
const element = this._hostRef.element.nativeElement as HTMLElement;
element.style.setProperty('--width', this.path === 'user-profile' ? 'unset' : '100%');
}
}