mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
[SM-251] Migrate to new avatar component (#3600)
This commit is contained in:
@@ -17,9 +17,9 @@ const SizeClasses: Record<SizeTypes, string[]> = {
|
||||
})
|
||||
export class AvatarComponent implements OnChanges {
|
||||
@Input() border = false;
|
||||
@Input() color: string;
|
||||
@Input() id: number;
|
||||
@Input() text: string;
|
||||
@Input() color?: string;
|
||||
@Input() id?: string;
|
||||
@Input() text?: string;
|
||||
@Input() size: SizeTypes = "default";
|
||||
|
||||
private svgCharCount = 2;
|
||||
@@ -42,7 +42,7 @@ export class AvatarComponent implements OnChanges {
|
||||
|
||||
private generate() {
|
||||
let chars: string = null;
|
||||
const upperCaseText = this.text.toUpperCase();
|
||||
const upperCaseText = this.text?.toUpperCase() ?? "";
|
||||
|
||||
chars = this.getFirstLetters(upperCaseText, this.svgCharCount);
|
||||
|
||||
@@ -58,9 +58,9 @@ export class AvatarComponent implements OnChanges {
|
||||
let svg: HTMLElement;
|
||||
let hexColor = this.color;
|
||||
|
||||
if (this.color != null) {
|
||||
if (!Utils.isNullOrWhitespace(this.color)) {
|
||||
svg = this.createSvgElement(this.svgSize, hexColor);
|
||||
} else if (this.id != null) {
|
||||
} else if (!Utils.isNullOrWhitespace(this.id)) {
|
||||
hexColor = Utils.stringToColor(this.id.toString());
|
||||
svg = this.createSvgElement(this.svgSize, hexColor);
|
||||
} else {
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
export * from "./async-actions";
|
||||
export * from "./avatar";
|
||||
export * from "./badge";
|
||||
export * from "./banner";
|
||||
export * from "./button";
|
||||
export * from "./callout";
|
||||
export * from "./dialog";
|
||||
export * from "./form-field";
|
||||
export * from "./icon";
|
||||
export * from "./icon-button";
|
||||
export * from "./icon";
|
||||
export * from "./link";
|
||||
export * from "./menu";
|
||||
export * from "./multi-select";
|
||||
export * from "./dialog";
|
||||
export * from "./link";
|
||||
export * from "./tabs";
|
||||
export * from "./toggle-group";
|
||||
export * from "./utils/i18n-mock.service";
|
||||
|
||||
Reference in New Issue
Block a user