diff --git a/libs/vault/src/components/spotlight/spotlight.component.html b/libs/vault/src/components/spotlight/spotlight.component.html new file mode 100644 index 00000000000..a8631a71020 --- /dev/null +++ b/libs/vault/src/components/spotlight/spotlight.component.html @@ -0,0 +1,34 @@ +
+
+
+

{{ title }}

+

+ {{ subtitle }} +

+
+ +
+ + + + +
diff --git a/libs/vault/src/components/spotlight/spotlight.component.ts b/libs/vault/src/components/spotlight/spotlight.component.ts new file mode 100644 index 00000000000..e52669cc404 --- /dev/null +++ b/libs/vault/src/components/spotlight/spotlight.component.ts @@ -0,0 +1,32 @@ +import { CommonModule } from "@angular/common"; +import { Component, EventEmitter, Input, Output } from "@angular/core"; + +import { ButtonModule, IconButtonModule, TypographyModule } from "@bitwarden/components"; +import { I18nPipe } from "@bitwarden/ui-common"; + +@Component({ + selector: "bit-spotlight", + templateUrl: "spotlight.component.html", + standalone: true, + imports: [ButtonModule, CommonModule, IconButtonModule, I18nPipe, TypographyModule], +}) +export class SpotlightComponent { + // The title of the component + @Input({ required: true }) title: string | null = null; + // The subtitle of the component + @Input({ required: true }) subtitle: string | null = null; + // The text to display on the button + @Input() buttonText?: string; + // Wheter the component can be dismissed, if true, the component will not show a close button + @Input() persistent = false; + @Output() onDismiss = new EventEmitter(); + @Output() onButtonClick = new EventEmitter(); + + handleButtonClick(): void { + this.onButtonClick.emit(); + } + + handleDismiss(): void { + this.onDismiss.emit(); + } +} diff --git a/libs/vault/src/components/spotlight/spotlight.stories.ts b/libs/vault/src/components/spotlight/spotlight.stories.ts new file mode 100644 index 00000000000..9f7757e4528 --- /dev/null +++ b/libs/vault/src/components/spotlight/spotlight.stories.ts @@ -0,0 +1,80 @@ +import { moduleMetadata, Meta, StoryObj } from "@storybook/angular"; + +import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; +import { + ButtonModule, + I18nMockService, + IconButtonModule, + TypographyModule, +} from "@bitwarden/components"; + +import { SpotlightComponent } from "./spotlight.component"; + +const meta: Meta = { + title: "Vault/Spotlight", + component: SpotlightComponent, + decorators: [ + moduleMetadata({ + imports: [ButtonModule, IconButtonModule, TypographyModule], + providers: [ + { + provide: I18nService, + useFactory: () => { + return new I18nMockService({ + close: "Close", + }); + }, + }, + ], + }), + ], + args: { + title: "Primary", + subtitle: "Callout Text", + buttonText: "Button", + }, +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = {}; + +export const WithoutButton: Story = { + args: { + buttonText: undefined, + }, +}; + +export const Persistent: Story = { + args: { + persistent: true, + }, +}; + +export const WithCustomButton: Story = { + args: { + buttonText: "Custom Button", + }, + render: (args) => ({ + props: args, + template: ` + + + + `, + }), +};