diff --git a/apps/browser/src/platform/popup/layout/popup-header.component.html b/apps/browser/src/platform/popup/layout/popup-header.component.html index e866ba4e81..31cd126532 100644 --- a/apps/browser/src/platform/popup/layout/popup-header.component.html +++ b/apps/browser/src/platform/popup/layout/popup-header.component.html @@ -1,5 +1,11 @@
@@ -11,7 +17,10 @@ [ariaLabel]="'back' | i18n" [bitAction]="backAction" > -

{{ pageTitle }}

+

+ {{ pageTitle }} +

+
diff --git a/apps/browser/src/platform/popup/layout/popup-header.component.ts b/apps/browser/src/platform/popup/layout/popup-header.component.ts index 1b491ea881..1e41f7ccbe 100644 --- a/apps/browser/src/platform/popup/layout/popup-header.component.ts +++ b/apps/browser/src/platform/popup/layout/popup-header.component.ts @@ -1,6 +1,6 @@ import { BooleanInput, coerceBooleanProperty } from "@angular/cdk/coercion"; import { CommonModule, Location } from "@angular/common"; -import { Component, Input } from "@angular/core"; +import { Component, Input, Signal, inject } from "@angular/core"; import { JslibModule } from "@bitwarden/angular/jslib.module"; import { @@ -10,6 +10,8 @@ import { TypographyModule, } from "@bitwarden/components"; +import { PopupPageComponent } from "./popup-page.component"; + @Component({ selector: "popup-header", templateUrl: "popup-header.component.html", @@ -17,6 +19,12 @@ import { imports: [TypographyModule, CommonModule, IconButtonModule, JslibModule, AsyncActionsModule], }) export class PopupHeaderComponent { + protected pageContentScrolled: Signal = inject(PopupPageComponent).isScrolled; + + /** Background color */ + @Input() + background: "default" | "alt" = "default"; + /** Display the back button, which uses Location.back() to go back one page in history */ @Input() get showBackButton() { diff --git a/apps/browser/src/platform/popup/layout/popup-layout.mdx b/apps/browser/src/platform/popup/layout/popup-layout.mdx index 49f76501ae..aa11b4099a 100644 --- a/apps/browser/src/platform/popup/layout/popup-layout.mdx +++ b/apps/browser/src/platform/popup/layout/popup-layout.mdx @@ -74,6 +74,9 @@ Basic usage example: - `showBackButton`: optional, defaults to `false` - Toggles the back button to appear. The back button uses `Location.back()` to navigate back one page in history. +- `background`: optional + - `"default"` uses a white background + - `"alt"` uses a transparent background **Slots** @@ -92,6 +95,12 @@ Usage example: ``` +### Transparent header + + + + + Common interactive elements to insert into the `end` slot are: - `app-current-account`: shows current account and switcher diff --git a/apps/browser/src/platform/popup/layout/popup-layout.stories.ts b/apps/browser/src/platform/popup/layout/popup-layout.stories.ts index 408988dca3..3d067b5305 100644 --- a/apps/browser/src/platform/popup/layout/popup-layout.stories.ts +++ b/apps/browser/src/platform/popup/layout/popup-layout.stories.ts @@ -303,6 +303,7 @@ export default { MockSettingsPageComponent, MockVaultPagePoppedComponent, NoItemsModule, + VaultComponent, ], providers: [ { @@ -311,6 +312,7 @@ export default { return new I18nMockService({ back: "Back", loading: "Loading", + search: "Search", }); }, }, @@ -421,3 +423,20 @@ export const Loading: Story = { `, }), }; + +export const TransparentHeader: Story = { + render: (args) => ({ + props: args, + template: /* HTML */ ` + + + 🤠 Custom Content + + + + + `, + }), +}; diff --git a/apps/browser/src/platform/popup/layout/popup-page.component.html b/apps/browser/src/platform/popup/layout/popup-page.component.html index d53ef24803..e62f9e70f9 100644 --- a/apps/browser/src/platform/popup/layout/popup-page.component.html +++ b/apps/browser/src/platform/popup/layout/popup-page.component.html @@ -1,20 +1,21 @@
-
+
- - - - -
-
-
-
diff --git a/apps/browser/src/platform/popup/layout/popup-page.component.ts b/apps/browser/src/platform/popup/layout/popup-page.component.ts index 0ce13ac4a4..50db3e370f 100644 --- a/apps/browser/src/platform/popup/layout/popup-page.component.ts +++ b/apps/browser/src/platform/popup/layout/popup-page.component.ts @@ -1,5 +1,5 @@ import { CommonModule } from "@angular/common"; -import { Component, Input, inject } from "@angular/core"; +import { Component, Input, inject, signal } from "@angular/core"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; @@ -17,6 +17,13 @@ export class PopupPageComponent { @Input() loading = false; + protected scrolled = signal(false); + isScrolled = this.scrolled.asReadonly(); + /** Accessible loading label for the spinner. Defaults to "loading" */ @Input() loadingText?: string = this.i18nService.t("loading"); + + handleScroll(event: Event) { + this.scrolled.set((event.currentTarget as HTMLElement).scrollTop !== 0); + } }