-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PM-7901] added new card view (#10321)
* added new card view
- Loading branch information
Showing
6 changed files
with
186 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
libs/vault/src/cipher-view/card-details/card-details-view.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<bit-section> | ||
<bit-section-header> | ||
<h2 bitTypography="h6">{{ setSectionTitle }}</h2> | ||
</bit-section-header> | ||
<bit-card> | ||
<bit-form-field> | ||
<bit-label>{{ "cardholderName" | i18n }}</bit-label> | ||
<input | ||
readonly | ||
bitInput | ||
type="text" | ||
[value]="card.cardholderName" | ||
aria-readonly="true" | ||
data-testid="cardholder-name" | ||
/> | ||
</bit-form-field> | ||
<bit-form-field *ngIf="card.number" [disableMargin]="!card.expiration && !card.code"> | ||
<bit-label>{{ "number" | i18n }}</bit-label> | ||
<input | ||
readonly | ||
bitInput | ||
type="password" | ||
[value]="card.number" | ||
aria-readonly="true" | ||
data-testid="cardholder-number" | ||
/> | ||
<button | ||
bitSuffix | ||
type="button" | ||
bitIconButton | ||
bitPasswordInputToggle | ||
data-testid="toggle-number" | ||
></button> | ||
<button | ||
bitIconButton="bwi-clone" | ||
bitSuffix | ||
type="button" | ||
[appCopyClick]="card.number" | ||
showToast | ||
[appA11yTitle]="'copyValue' | i18n" | ||
data-testid="copy-number" | ||
></button> | ||
</bit-form-field> | ||
<bit-form-field *ngIf="card.expiration" [disableMargin]="!card.code"> | ||
<bit-label>{{ "expiration" | i18n }}</bit-label> | ||
<input | ||
readonly | ||
bitInput | ||
type="text" | ||
[value]="card.expiration" | ||
aria-readonly="true" | ||
data-testid="cardholder-expiration" | ||
/> | ||
</bit-form-field> | ||
<bit-form-field *ngIf="card.code" disableMargin> | ||
<bit-label>{{ "securityCode" | i18n }}</bit-label> | ||
<input | ||
readonly | ||
bitInput | ||
type="password" | ||
[value]="card.code" | ||
aria-readonly="true" | ||
data-testid="cardholder-code" | ||
/> | ||
<button | ||
bitSuffix | ||
type="button" | ||
bitIconButton | ||
bitPasswordInputToggle | ||
data-testid="toggle-code" | ||
></button> | ||
<button | ||
bitIconButton="bwi-clone" | ||
bitSuffix | ||
type="button" | ||
[appCopyClick]="card.code" | ||
showToast | ||
[appA11yTitle]="'copyValue' | i18n" | ||
data-testid="copy-code" | ||
></button> | ||
</bit-form-field> | ||
</bit-card> | ||
</bit-section> |
45 changes: 45 additions & 0 deletions
45
libs/vault/src/cipher-view/card-details/card-details-view.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { CommonModule } from "@angular/common"; | ||
import { Component, Input } from "@angular/core"; | ||
|
||
import { JslibModule } from "@bitwarden/angular/jslib.module"; | ||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; | ||
import { CardView } from "@bitwarden/common/vault/models/view/card.view"; | ||
import { | ||
CardComponent, | ||
SectionComponent, | ||
SectionHeaderComponent, | ||
TypographyModule, | ||
FormFieldModule, | ||
IconButtonModule, | ||
} from "@bitwarden/components"; | ||
|
||
import { OrgIconDirective } from "../../components/org-icon.directive"; | ||
|
||
@Component({ | ||
selector: "app-card-details-view", | ||
templateUrl: "card-details-view.component.html", | ||
standalone: true, | ||
imports: [ | ||
CommonModule, | ||
JslibModule, | ||
CardComponent, | ||
SectionComponent, | ||
SectionHeaderComponent, | ||
TypographyModule, | ||
OrgIconDirective, | ||
FormFieldModule, | ||
IconButtonModule, | ||
], | ||
}) | ||
export class CardDetailsComponent { | ||
@Input() card: CardView; | ||
|
||
constructor(private i18nService: I18nService) {} | ||
|
||
get setSectionTitle() { | ||
if (this.card.brand && this.card.brand !== "Other") { | ||
return this.i18nService.t("cardBrandDetails", this.card.brand); | ||
} | ||
return this.i18nService.t("cardDetails"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters