Create "new Send-button with type selection (#9842)

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
Daniel James Smith 2024-06-26 18:08:18 +02:00 committed by GitHub
parent 1495b06736
commit 5a74371672
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 38 additions and 0 deletions

View File

@ -1 +1,2 @@
export * from "./icons";
export { NewSendDropdownComponent } from "./new-send-dropdown/new-send-dropdown.component";

View File

@ -0,0 +1,14 @@
<button bitButton [bitMenuTriggerFor]="itemOptions" buttonType="primary" type="button">
<i class="bwi bwi-plus-f" aria-hidden="true"></i>
{{ "new" | i18n }}
</button>
<bit-menu #itemOptions>
<a type="button" bitMenuItem (click)="newItemNavigate(sendType.Text)">
<i class="bwi bwi-file-text" slot="start" aria-hidden="true"></i>
{{ "sendTypeText" | i18n }}
</a>
<a type="button" bitMenuItem (click)="newItemNavigate(sendType.File)">
<i class="bwi bwi-file" slot="start" aria-hidden="true"></i>
{{ "sendTypeFile" | i18n }}
</a>
</bit-menu>

View File

@ -0,0 +1,23 @@
import { CommonModule } from "@angular/common";
import { Component } from "@angular/core";
import { Router, RouterLink } from "@angular/router";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
import { ButtonModule, MenuModule } from "@bitwarden/components";
@Component({
selector: "tools-new-send-dropdown",
templateUrl: "new-send-dropdown.component.html",
standalone: true,
imports: [JslibModule, CommonModule, ButtonModule, RouterLink, MenuModule],
})
export class NewSendDropdownComponent {
sendType = SendType;
constructor(private router: Router) {}
newItemNavigate(type: SendType) {
void this.router.navigate(["/add-send"], { queryParams: { type: type, isNew: true } });
}
}