mirror of
https://github.com/bitwarden/browser
synced 2026-02-07 12:13:45 +00:00
* rename bit-icon to bit-svg; create new bit-icon for font icons Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * find and replace current usage Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * add custom eslint warning Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix incorrect usage * fix tests * fix tests * Update libs/components/src/svg/index.ts Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> * Update libs/eslint/components/no-bwi-class-usage.spec.mjs Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> * update component api * update class name * use icon type in iconButton component * update type Icon --> BitSvg * fix bad renames * fix more renames * fix bad input * revert iconButton type * fix lint * fix more inputs * misc fixes Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix test * add eslint ignore * fix lint * add comparison story --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
91 lines
2.9 KiB
TypeScript
91 lines
2.9 KiB
TypeScript
import { CommonModule } from "@angular/common";
|
|
import {
|
|
Component,
|
|
HostBinding,
|
|
OnChanges,
|
|
OnInit,
|
|
SimpleChanges,
|
|
input,
|
|
model,
|
|
} from "@angular/core";
|
|
import { RouterModule } from "@angular/router";
|
|
import { firstValueFrom } from "rxjs";
|
|
|
|
import { BitwardenLogo, BitSvg } from "@bitwarden/assets/svg";
|
|
import { ClientType } from "@bitwarden/common/enums";
|
|
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
|
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
|
|
|
import { LandingContentMaxWidthType } from "../landing-layout";
|
|
import { LandingLayoutModule } from "../landing-layout/landing-layout.module";
|
|
import { SharedModule } from "../shared";
|
|
import { SvgModule } from "../svg";
|
|
import { TypographyModule } from "../typography";
|
|
|
|
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
|
|
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
|
|
@Component({
|
|
selector: "auth-anon-layout",
|
|
templateUrl: "./anon-layout.component.html",
|
|
imports: [
|
|
SvgModule,
|
|
CommonModule,
|
|
TypographyModule,
|
|
SharedModule,
|
|
RouterModule,
|
|
LandingLayoutModule,
|
|
],
|
|
})
|
|
export class AnonLayoutComponent implements OnInit, OnChanges {
|
|
@HostBinding("class")
|
|
get classList() {
|
|
// AnonLayout should take up full height of parent container for proper footer placement.
|
|
return ["tw-h-full"];
|
|
}
|
|
|
|
readonly title = input<string>();
|
|
readonly subtitle = input<string>();
|
|
readonly icon = model.required<BitSvg | null>();
|
|
readonly showReadonlyHostname = input<boolean>(false);
|
|
readonly hideLogo = input<boolean>(false);
|
|
readonly hideFooter = input<boolean>(false);
|
|
readonly hideCardWrapper = input<boolean>(false);
|
|
readonly hideBackgroundIllustration = input<boolean>(false);
|
|
|
|
/**
|
|
* Max width of the anon layout title, subtitle, and content areas.
|
|
*
|
|
* @default 'md'
|
|
*/
|
|
readonly maxWidth = model<LandingContentMaxWidthType>("md");
|
|
|
|
protected logo = BitwardenLogo;
|
|
protected year: string;
|
|
protected clientType: ClientType;
|
|
protected hostname?: string;
|
|
protected version?: string;
|
|
|
|
protected hideYearAndVersion = false;
|
|
|
|
constructor(
|
|
private environmentService: EnvironmentService,
|
|
private platformUtilsService: PlatformUtilsService,
|
|
) {
|
|
this.year = new Date().getFullYear().toString();
|
|
this.clientType = this.platformUtilsService.getClientType();
|
|
this.hideYearAndVersion = this.clientType !== ClientType.Web;
|
|
}
|
|
|
|
async ngOnInit() {
|
|
this.maxWidth.set(this.maxWidth() ?? "md");
|
|
this.hostname = (await firstValueFrom(this.environmentService.environment$)).getHostname();
|
|
this.version = await this.platformUtilsService.getApplicationVersion();
|
|
}
|
|
|
|
async ngOnChanges(changes: SimpleChanges) {
|
|
if (changes.maxWidth) {
|
|
this.maxWidth.set(changes.maxWidth.currentValue ?? "md");
|
|
}
|
|
}
|
|
}
|