1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 17:23:37 +00:00
Files
browser/bitwarden_license/bit-web/src/app/secrets-manager/layout/header.component.ts
Will Martin 62986be1a2 [SM-325] update header layout to support projected content (#4509)
* expose breadcrumbs to shared module; remove extra whitespace from breadcrumb

* update sm-header to accept projected content; update layout style & semantics

* remove searchTitle route data; change title to titleId

* update styles

* update SM pages to use new header

* add button slot to header

* remove breadcrumbs from shared module

* update project tabs

* update content projection to use slot attribute

* hide tabs container

* add icon input to header

* add breadcrumbs to service account page

* update padding

* update styles

* code style changes

* create access token button component

* simplify access token logic

* add create access token button to header

* update sm-no-items content projection

* revert irrelevant commits

* add header title slot; rename template vars for clarity

* add storybook stories

* remove sm-new-menu from default view; refactor search/button content projection

* remove unused styles; fix title truncate

* remove unnecessary classes

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>

---------

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
2023-01-30 10:58:40 -05:00

45 lines
1.1 KiB
TypeScript

import { Component, Input } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { combineLatest, map, Observable } from "rxjs";
import { StateService } from "@bitwarden/common/abstractions/state.service";
import { AccountProfile } from "@bitwarden/common/models/domain/account";
@Component({
selector: "sm-header",
templateUrl: "./header.component.html",
})
export class HeaderComponent {
/**
* Custom title that overrides the route data `titleId`
*/
@Input() title: string;
/**
* Icon to show before the title
*/
@Input() icon: string;
protected routeData$: Observable<{ titleId: string }>;
protected account$: Observable<AccountProfile>;
constructor(private route: ActivatedRoute, private stateService: StateService) {
this.routeData$ = this.route.data.pipe(
map((params) => {
return {
titleId: params.titleId,
};
})
);
this.account$ = combineLatest([
this.stateService.activeAccount$,
this.stateService.accounts$,
]).pipe(
map(([activeAccount, accounts]) => {
return accounts[activeAccount]?.profile;
})
);
}
}