1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-22 16:29:09 +01:00

[EC-694] Verify Email - Replace Bootstrap with Tailwind (#4211)

* [EC-694] Replace Boostrap with Tailwind

* [EC-694] Simplify tailwind classes

* [EC-694] Update bitAction handler method to remove Promise wrapper

* [EC-694] Coerce bitButton block boolean

* [EC-694] Remove unnecessary try/catch and logging

* [EC-694] Coersce block boolean

* [EC-694] Update boolean coercion

* [EC-694] Apply default value for block boolean and simplify attr class conditional

* [EC-694] Fix block class application / test
This commit is contained in:
Vincent Salucci 2023-01-10 08:59:13 -06:00 committed by GitHub
parent f4219bada9
commit 4eab97272f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 32 deletions

View File

@ -1,21 +1,11 @@
<div class="card border-warning">
<div class="card-header bg-warning text-white">
<div class="tw-rounded tw-border tw-border-solid tw-border-warning-500 tw-bg-background">
<div class="tw-bg-warning-500 tw-px-5 tw-py-2.5 tw-font-bold tw-uppercase tw-text-contrast">
<i class="bwi bwi-envelope bwi-fw" aria-hidden="true"></i> {{ "verifyEmail" | i18n }}
</div>
<div class="card-body">
<div class="tw-p-5">
<p>{{ "verifyEmailDesc" | i18n }}</p>
<button
type="button"
class="btn btn-block btn-outline-secondary btn-submit"
#sendBtn
[appApiAction]="actionPromise"
[disabled]="$any(sendBtn).loading"
(click)="send()"
>
<i class="bwi bwi-spin bwi-spinner" title="{{ 'loading' | i18n }}" aria-hidden="true"></i>
<span>
{{ "sendEmail" | i18n }}
</span>
<button id="sendBtn" bitButton type="button" block [bitAction]="send">
{{ "sendEmail" | i18n }}
</button>
</div>
</div>

View File

@ -39,17 +39,7 @@ export class VerifyEmailComponent {
);
}
async send() {
if (this.actionPromise != null) {
return;
}
try {
this.actionPromise = this.verifyEmail();
await this.actionPromise;
} catch (e) {
this.logService.error(e);
}
this.actionPromise = null;
}
send = async () => {
await this.verifyEmail();
};
}

View File

@ -1,3 +1,4 @@
import { coerceBooleanProperty } from "@angular/cdk/coercion";
import { Input, HostBinding, Component } from "@angular/core";
import { ButtonLikeAbstraction, ButtonType } from "../shared/button-like.abstraction";
@ -68,9 +69,7 @@ export class ButtonComponent implements ButtonLikeAbstraction {
"hover:tw-no-underline",
"focus:tw-outline-none",
]
.concat(
this.block == null || this.block === false ? ["tw-inline-block"] : ["tw-w-full", "tw-block"]
)
.concat(this.block ? ["tw-w-full", "tw-block"] : ["tw-inline-block"])
.concat(buttonStyles[this.buttonType ?? "secondary"]);
}
@ -81,7 +80,17 @@ export class ButtonComponent implements ButtonLikeAbstraction {
}
@Input() buttonType: ButtonType;
@Input() block?: boolean;
private _block = false;
@Input()
get block(): boolean {
return this._block;
}
set block(value: boolean | "") {
this._block = coerceBooleanProperty(value);
}
@Input() loading = false;