mirror of
https://github.com/bitwarden/browser
synced 2026-02-18 10:23:52 +00:00
29 lines
543 B
TypeScript
29 lines
543 B
TypeScript
import { Directive, inject } from "@angular/core";
|
|
|
|
import { DrawerComponent } from "./drawer.component";
|
|
|
|
/**
|
|
* Closes the ancestor drawer
|
|
*
|
|
* @example
|
|
*
|
|
* ```html
|
|
* <bit-drawer>
|
|
* <button type="button" bitButton bitDrawerClose>Close</button>
|
|
* </bit-drawer>
|
|
* ```
|
|
**/
|
|
@Directive({
|
|
selector: "button[bitDrawerClose]",
|
|
host: {
|
|
"(click)": "onClick()",
|
|
},
|
|
})
|
|
export class DrawerCloseDirective {
|
|
private drawer = inject(DrawerComponent, { optional: true });
|
|
|
|
protected onClick() {
|
|
this.drawer?.open.set(false);
|
|
}
|
|
}
|