1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00

icon code

This commit is contained in:
Kyle Spearrin 2018-11-06 12:13:11 -05:00
parent 6fa3538cbc
commit 52e087e4dd

View File

@ -6,6 +6,8 @@ import {
import { CipherType } from '../../enums/cipherType'; import { CipherType } from '../../enums/cipherType';
import { CipherView } from '../../models/view/cipherView';
import { EnvironmentService } from '../../abstractions/environment.service'; import { EnvironmentService } from '../../abstractions/environment.service';
import { StateService } from '../../abstractions/state.service'; import { StateService } from '../../abstractions/state.service';
@ -13,12 +15,21 @@ import { ConstantsService } from '../../services/constants.service';
import { Utils } from '../../misc/utils'; import { Utils } from '../../misc/utils';
const IconMap = {
'fa-globe': String.fromCharCode(0xf0ac),
'fa-sticky-note-o': String.fromCharCode(0xf24a),
'fa-id-card-o': String.fromCharCode(0xf2c3),
'fa-credit-card': String.fromCharCode(0xf09d),
'fa-android': String.fromCharCode(0xf17b),
'fa-apple': String.fromCharCode(0xf179),
};
@Component({ @Component({
selector: 'app-vault-icon', selector: 'app-vault-icon',
templateUrl: 'icon.component.html', templateUrl: 'icon.component.html',
}) })
export class IconComponent implements OnChanges { export class IconComponent implements OnChanges {
@Input() cipher: any; @Input() cipher: CipherView;
icon: string; icon: string;
image: string; image: string;
fallbackImage: string; fallbackImage: string;
@ -59,6 +70,10 @@ export class IconComponent implements OnChanges {
} }
} }
get iconCode(): string {
return IconMap[this.icon];
}
private setLoginIcon() { private setLoginIcon() {
if (this.cipher.login.uri) { if (this.cipher.login.uri) {
let hostnameUri = this.cipher.login.uri; let hostnameUri = this.cipher.login.uri;