1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 23:33:31 +00:00

[CL-160] Rename BadgeType to BadgeVariant (#7244)

We're establishing a common language for the Component Library. As part of this work we're renaming componentType to variant. Starting with badges.
This commit is contained in:
Oscar Hinton
2023-12-19 19:22:37 +01:00
committed by GitHub
parent 6122dbf96f
commit 017da06f9a
30 changed files with 91 additions and 93 deletions

View File

@@ -88,7 +88,7 @@
*ngIf="!g.details.accessAll"
[items]="g.collectionNames"
[maxItems]="3"
badgeType="secondary"
variant="secondary"
></bit-badge-list>
<span *ngIf="g.details.accessAll">{{ "all" | i18n }}</span>
</td>

View File

@@ -5,7 +5,7 @@
<span class="tw-text-sm tw-normal-case tw-text-muted" *ngIf="!loading && params.name">{{
params.name
}}</span>
<span bitBadge badgeType="secondary" *ngIf="isRevoked">{{ "revoked" | i18n }}</span>
<span bitBadge variant="secondary" *ngIf="isRevoked">{{ "revoked" | i18n }}</span>
</span>
<div bitDialogContent>
<ng-container *ngIf="loading">

View File

@@ -8,22 +8,22 @@
[attr.aria-label]="'memberStatusFilter' | i18n"
>
<bit-toggle [value]="null">
{{ "all" | i18n }} <span bitBadge badgeType="info" *ngIf="allCount">{{ allCount }}</span>
{{ "all" | i18n }} <span bitBadge variant="info" *ngIf="allCount">{{ allCount }}</span>
</bit-toggle>
<bit-toggle [value]="userStatusType.Invited">
{{ "invited" | i18n }}
<span bitBadge badgeType="info" *ngIf="invitedCount">{{ invitedCount }}</span>
<span bitBadge variant="info" *ngIf="invitedCount">{{ invitedCount }}</span>
</bit-toggle>
<bit-toggle [value]="userStatusType.Accepted">
{{ "needsConfirmation" | i18n }}
<span bitBadge badgeType="info" *ngIf="acceptedCount">{{ acceptedCount }}</span>
<span bitBadge variant="info" *ngIf="acceptedCount">{{ acceptedCount }}</span>
</bit-toggle>
<bit-toggle [value]="userStatusType.Revoked">
{{ "revoked" | i18n }}
<span bitBadge badgeType="info" *ngIf="revokedCount">{{ revokedCount }}</span>
<span bitBadge variant="info" *ngIf="revokedCount">{{ revokedCount }}</span>
</bit-toggle>
</bit-toggle-group>
@@ -160,21 +160,21 @@
<span
bitBadge
class="tw-text-xs"
badgeType="secondary"
variant="secondary"
*ngIf="u.status === userStatusType.Invited"
>{{ "invited" | i18n }}</span
>
<span
bitBadge
class="tw-text-xs"
badgeType="warning"
variant="warning"
*ngIf="u.status === userStatusType.Accepted"
>{{ "needsConfirmation" | i18n }}</span
>
<span
bitBadge
class="tw-text-xs"
badgeType="secondary"
variant="secondary"
*ngIf="u.status === userStatusType.Revoked"
>{{ "revoked" | i18n }}</span
>
@@ -195,7 +195,7 @@
*ngIf="organization.useGroups || !u.accessAll"
[items]="organization.useGroups ? u.groupNames : u.collectionNames"
[maxItems]="3"
badgeType="secondary"
variant="secondary"
></bit-badge-list>
<span *ngIf="!organization.useGroups && u.accessAll">{{ "all" | i18n }}</span>
</td>

View File

@@ -14,7 +14,7 @@
<tr *ngFor="let p of policies">
<td *ngIf="p.display(organization)">
<a href="#" appStopClick (click)="edit(p)">{{ p.name | i18n }}</a>
<span bitBadge badgeType="success" *ngIf="policiesEnabledMap.get(p.type)">{{
<span bitBadge variant="success" *ngIf="policiesEnabledMap.get(p.type)">{{
"on" | i18n
}}</span>
<small class="text-muted d-block">{{ p.description | i18n }}</small>

View File

@@ -63,7 +63,7 @@
<div class="tw-flex tw-flex-col">
<div>
{{ item.labelName }}
<span *ngIf="$any(item).status == 0" bitBadge badgeType="secondary">
<span *ngIf="$any(item).status == 0" bitBadge variant="secondary">
{{ "invited" | i18n }}
</span>
</div>

View File

@@ -43,21 +43,15 @@
</td>
<td>
<a href="#" appStopClick (click)="edit(c)">{{ c.email }}</a>
<span bitBadge variant="secondary" *ngIf="c.status === emergencyAccessStatusType.Invited">{{
"invited" | i18n
}}</span>
<span bitBadge variant="warning" *ngIf="c.status === emergencyAccessStatusType.Accepted">{{
"accepted" | i18n
}}</span>
<span
bitBadge
badgeType="secondary"
*ngIf="c.status === emergencyAccessStatusType.Invited"
>{{ "invited" | i18n }}</span
>
<span
bitBadge
badgeType="warning"
*ngIf="c.status === emergencyAccessStatusType.Accepted"
>{{ "accepted" | i18n }}</span
>
<span
bitBadge
badgeType="warning"
variant="warning"
*ngIf="c.status === emergencyAccessStatusType.RecoveryInitiated"
>{{ "emergencyAccessRecoveryInitiated" | i18n }}</span
>
@@ -163,21 +157,18 @@
<span bitBadge *ngIf="c.status === emergencyAccessStatusType.Invited">{{
"invited" | i18n
}}</span>
<span bitBadge variant="warning" *ngIf="c.status === emergencyAccessStatusType.Accepted">{{
"accepted" | i18n
}}</span>
<span
bitBadge
badgeType="warning"
*ngIf="c.status === emergencyAccessStatusType.Accepted"
>{{ "accepted" | i18n }}</span
>
<span
bitBadge
badgeType="warning"
variant="warning"
*ngIf="c.status === emergencyAccessStatusType.RecoveryInitiated"
>{{ "emergencyAccessRecoveryInitiated" | i18n }}</span
>
<span
bitBadge
badgeType="success"
variant="success"
*ngIf="c.status === emergencyAccessStatusType.RecoveryApproved"
>{{ "emergencyAccessRecoveryApproved" | i18n }}</span
>

View File

@@ -4,21 +4,21 @@
<span
*ngIf="requireSsoPolicyEnabled"
bitBadge
badgeType="secondary"
variant="secondary"
class="tw-max-w-full !tw-align-middle"
>
{{ "off" | i18n }} - {{ "ssoLoginIsRequired" | i18n }}
</span>
<ng-container *ngIf="!requireSsoPolicyEnabled">
<span *ngIf="hasCredentials" bitBadge badgeType="success" class="!tw-align-middle">{{
<span *ngIf="hasCredentials" bitBadge variant="success" class="!tw-align-middle">{{
"on" | i18n
}}</span>
<span *ngIf="!hasCredentials" bitBadge badgeType="secondary" class="!tw-align-middle">{{
<span *ngIf="!hasCredentials" bitBadge variant="secondary" class="!tw-align-middle">{{
"off" | i18n
}}</span>
</ng-container>
</ng-container>
<span bitBadge badgeType="warning" class="!tw-align-middle">{{ "beta" | i18n }}</span>
<span bitBadge variant="warning" class="!tw-align-middle">{{ "beta" | i18n }}</span>
<ng-container *ngIf="loading">
<i class="bwi bwi-spinner bwi-spin tw-ml-1" aria-hidden="true"></i>
</ng-container>

View File

@@ -63,7 +63,7 @@
<dt>{{ "status" | i18n }}</dt>
<dd>
<span class="text-capitalize">{{ (subscription && subscription.status) || "-" }}</span>
<span bitBadge badgeType="warning" *ngIf="subscriptionMarkedForCancel">{{
<span bitBadge variant="warning" *ngIf="subscriptionMarkedForCancel">{{
"pendingCancellation" | i18n
}}</span>
</dd>

View File

@@ -49,7 +49,7 @@
<span class="tw-capitalize">{{
isSponsoredSubscription ? "sponsored" : subscription.status || "-"
}}</span>
<span bitBadge badgeType="warning" *ngIf="subscriptionMarkedForCancel">{{
<span bitBadge variant="warning" *ngIf="subscriptionMarkedForCancel">{{
"pendingCancellation" | i18n
}}</span>
</dd>
@@ -96,7 +96,7 @@
{{ "beta" | i18n }}
({{ "annually" | i18n }}) @
{{ 0 | currency: "$" }}
<span bitBadge badgeType="warning" class="tw-ml-2">{{
<span bitBadge variant="warning" class="tw-ml-2">{{
"betaEnding" | i18n | uppercase
}}</span>
</td>

View File

@@ -60,7 +60,7 @@
</app-org-badge>
</td>
<td class="text-right">
<span bitBadge badgeType="warning">
<span bitBadge variant="warning">
{{ "exposedXTimes" | i18n: (exposedPasswordMap.get(c.id) | number) }}
</span>
</td>

View File

@@ -75,7 +75,7 @@
</app-org-badge>
</td>
<td class="text-right">
<span bitBadge badgeType="warning">
<span bitBadge variant="warning">
{{ "reusedXTimes" | i18n: passwordUseMap.get(c.login.password) }}
</span>
</td>

View File

@@ -75,7 +75,7 @@
</app-org-badge>
</td>
<td class="text-right">
<span bitBadge [badgeType]="passwordStrengthMap.get(c.id)[1]">
<span bitBadge [variant]="passwordStrengthMap.get(c.id)[1]">
{{ passwordStrengthMap.get(c.id)[0] | i18n }}
</span>
</td>

View File

@@ -7,7 +7,7 @@ import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/pass
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { CipherType } from "@bitwarden/common/vault/enums";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { BadgeTypes } from "@bitwarden/components";
import { BadgeVariant } from "@bitwarden/components";
import { PasswordRepromptService } from "@bitwarden/vault";
import { CipherReportComponent } from "./cipher-report.component";
@@ -17,7 +17,7 @@ import { CipherReportComponent } from "./cipher-report.component";
templateUrl: "weak-passwords-report.component.html",
})
export class WeakPasswordsReportComponent extends CipherReportComponent implements OnInit {
passwordStrengthMap = new Map<string, [string, BadgeTypes]>();
passwordStrengthMap = new Map<string, [string, BadgeVariant]>();
disabled = true;
private passwordStrengthCache = new Map<string, number>();
@@ -118,7 +118,7 @@ export class WeakPasswordsReportComponent extends CipherReportComponent implemen
return c.login.password + "_____" + (this.isUserNameNotEmpty(c) ? c.login.username : "");
}
private scoreKey(score: number): [string, BadgeTypes] {
private scoreKey(score: number): [string, BadgeVariant] {
switch (score) {
case 4:
return ["strong", "success"];

View File

@@ -15,7 +15,7 @@
</div>
<span
bitBadge
[badgeType]="requiresPremium ? 'success' : 'primary'"
[variant]="requiresPremium ? 'success' : 'primary'"
class="tw-absolute tw-left-2 tw-top-2 tw-leading-none"
*ngIf="disabled"
>

View File

@@ -5,7 +5,7 @@ import { MessagingService } from "@bitwarden/common/platform/abstractions/messag
@Component({
selector: "app-premium-badge",
template: `
<button type="button" *appNotPremium bitBadge badgeType="success" (click)="premiumRequired()">
<button type="button" *appNotPremium bitBadge variant="success" (click)="premiumRequired()">
{{ "premium" | i18n }}
</button>
`,

View File

@@ -267,7 +267,7 @@
href="#"
appStopClick
bitBadge
badgeType="primary"
variant="primary"
class="tw-ml-4"
(click)="upgradeOrganization()"
*ngIf="

View File

@@ -1,6 +1,6 @@
<ng-container *ngFor="let c of shownCollections">
<span bitBadge badgeType="secondary">{{ c | collectionNameFromId: collections }}</span>
<span bitBadge variant="secondary">{{ c | collectionNameFromId: collections }}</span>
</ng-container>
<ng-container *ngIf="showXMore">
<span bitBadge badgeType="secondary">+ {{ xMoreCount }} more</span>
<span bitBadge variant="secondary">+ {{ xMoreCount }} more</span>
</ng-container>

View File

@@ -1 +1 @@
<bit-badge-list [items]="groupNames" [maxItems]="3" badgeType="secondary"></bit-badge-list>
<bit-badge-list [items]="groupNames" [maxItems]="3" variant="secondary"></bit-badge-list>