mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 13:53:34 +00:00
[CL-118][CL-164][PM-8019] collapsible side navigation (#6383)
This commit is contained in:
26
libs/components/src/navigation/side-nav.component.ts
Normal file
26
libs/components/src/navigation/side-nav.component.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { Component, ElementRef, Input, ViewChild } from "@angular/core";
|
||||
|
||||
import { SideNavService } from "./side-nav.service";
|
||||
|
||||
@Component({
|
||||
selector: "bit-side-nav",
|
||||
templateUrl: "side-nav.component.html",
|
||||
})
|
||||
export class SideNavComponent {
|
||||
@Input() variant: "primary" | "secondary" = "primary";
|
||||
|
||||
@ViewChild("toggleButton", { read: ElementRef, static: true })
|
||||
private toggleButton: ElementRef<HTMLButtonElement>;
|
||||
|
||||
constructor(protected sideNavService: SideNavService) {}
|
||||
|
||||
protected handleKeyDown = (event: KeyboardEvent) => {
|
||||
if (event.key === "Escape") {
|
||||
this.sideNavService.setClose();
|
||||
this.toggleButton?.nativeElement.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user