mirror of
https://github.com/bitwarden/browser.git
synced 2025-03-13 13:49:37 +01:00
[CL-166] add title and subtitle inputs to bit-dialog (#7597)
This commit is contained in:
parent
196eddb391
commit
d4968bb225
@ -6,6 +6,7 @@ import { AsyncActionsModule } from "../async-actions";
|
|||||||
import { ButtonModule } from "../button";
|
import { ButtonModule } from "../button";
|
||||||
import { IconButtonModule } from "../icon-button";
|
import { IconButtonModule } from "../icon-button";
|
||||||
import { SharedModule } from "../shared";
|
import { SharedModule } from "../shared";
|
||||||
|
import { TypographyModule } from "../typography";
|
||||||
|
|
||||||
import { DialogComponent } from "./dialog/dialog.component";
|
import { DialogComponent } from "./dialog/dialog.component";
|
||||||
import { DialogService } from "./dialog.service";
|
import { DialogService } from "./dialog.service";
|
||||||
@ -22,6 +23,7 @@ import { IconDirective, SimpleDialogComponent } from "./simple-dialog/simple-dia
|
|||||||
CdkDialogModule,
|
CdkDialogModule,
|
||||||
IconButtonModule,
|
IconButtonModule,
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
|
TypographyModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
DialogCloseDirective,
|
DialogCloseDirective,
|
||||||
|
@ -35,8 +35,7 @@ class StoryDialogComponent {
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
template: `
|
template: `
|
||||||
<bit-dialog dialogSize="large">
|
<bit-dialog title="Dialog Title" dialogSize="large">
|
||||||
<span bitDialogTitle>Dialog Title</span>
|
|
||||||
<span bitDialogContent>
|
<span bitDialogContent>
|
||||||
Dialog body text goes here.
|
Dialog body text goes here.
|
||||||
<br />
|
<br />
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
<div
|
<section
|
||||||
class="tw-flex tw-w-full tw-flex-col tw-self-center tw-overflow-hidden tw-rounded tw-border tw-border-solid tw-border-secondary-300 tw-bg-background tw-text-main"
|
class="tw-flex tw-w-full tw-flex-col tw-self-center tw-overflow-hidden tw-rounded tw-border tw-border-solid tw-border-secondary-300 tw-bg-background tw-text-main"
|
||||||
[ngClass]="width"
|
[ngClass]="width"
|
||||||
@fadeIn
|
@fadeIn
|
||||||
>
|
>
|
||||||
<div
|
<header
|
||||||
class="tw-flex tw-items-center tw-gap-4 tw-border-0 tw-border-b tw-border-solid tw-border-secondary-300 tw-p-4"
|
class="tw-flex tw-justify-between tw-items-center tw-gap-4 tw-border-0 tw-border-b tw-border-solid tw-border-secondary-300 tw-p-4"
|
||||||
>
|
>
|
||||||
<h1 bitDialogTitleContainer class="tw-mb-0 tw-grow tw-truncate tw-text-lg">
|
<h1 bitDialogTitleContainer bitTypography="h3" noMargin class="tw-mb-0 tw-truncate">
|
||||||
|
{{ title }}
|
||||||
|
<span *ngIf="subtitle" class="tw-text-muted tw-font-normal tw-text-sm">
|
||||||
|
{{ subtitle }}
|
||||||
|
</span>
|
||||||
<ng-content select="[bitDialogTitle]"></ng-content>
|
<ng-content select="[bitDialogTitle]"></ng-content>
|
||||||
</h1>
|
</h1>
|
||||||
<button
|
<button
|
||||||
@ -18,7 +22,7 @@
|
|||||||
[attr.title]="'close' | i18n"
|
[attr.title]="'close' | i18n"
|
||||||
[attr.aria-label]="'close' | i18n"
|
[attr.aria-label]="'close' | i18n"
|
||||||
></button>
|
></button>
|
||||||
</div>
|
</header>
|
||||||
|
|
||||||
<div class="tw-relative tw-flex tw-flex-col tw-overflow-hidden">
|
<div class="tw-relative tw-flex tw-flex-col tw-overflow-hidden">
|
||||||
<div
|
<div
|
||||||
@ -39,9 +43,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<footer
|
||||||
class="tw-flex tw-flex-row tw-items-center tw-gap-2 tw-border-0 tw-border-t tw-border-solid tw-border-secondary-300 tw-bg-background-alt tw-p-4"
|
class="tw-flex tw-flex-row tw-items-center tw-gap-2 tw-border-0 tw-border-t tw-border-solid tw-border-secondary-300 tw-bg-background-alt tw-p-4"
|
||||||
>
|
>
|
||||||
<ng-content select="[bitDialogFooter]"></ng-content>
|
<ng-content select="[bitDialogFooter]"></ng-content>
|
||||||
</div>
|
</footer>
|
||||||
</div>
|
</section>
|
||||||
|
@ -14,6 +14,16 @@ export class DialogComponent {
|
|||||||
*/
|
*/
|
||||||
@Input() dialogSize: "small" | "default" | "large" = "default";
|
@Input() dialogSize: "small" | "default" | "large" = "default";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Title to show in the dialog's header
|
||||||
|
*/
|
||||||
|
@Input() title: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subtitle to show in the dialog's header
|
||||||
|
*/
|
||||||
|
@Input() subtitle: string;
|
||||||
|
|
||||||
private _disablePadding = false;
|
private _disablePadding = false;
|
||||||
/**
|
/**
|
||||||
* Disable the built-in padding on the dialog, for use with tabbed dialogs.
|
* Disable the built-in padding on the dialog, for use with tabbed dialogs.
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { NoopAnimationsModule } from "@angular/platform-browser/animations";
|
||||||
import { Meta, StoryObj, moduleMetadata } from "@storybook/angular";
|
import { Meta, StoryObj, moduleMetadata } from "@storybook/angular";
|
||||||
|
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
@ -7,8 +8,7 @@ import { IconButtonModule } from "../../icon-button";
|
|||||||
import { SharedModule } from "../../shared";
|
import { SharedModule } from "../../shared";
|
||||||
import { TabsModule } from "../../tabs";
|
import { TabsModule } from "../../tabs";
|
||||||
import { I18nMockService } from "../../utils/i18n-mock.service";
|
import { I18nMockService } from "../../utils/i18n-mock.service";
|
||||||
import { DialogCloseDirective } from "../directives/dialog-close.directive";
|
import { DialogModule } from "../dialog.module";
|
||||||
import { DialogTitleContainerDirective } from "../directives/dialog-title-container.directive";
|
|
||||||
|
|
||||||
import { DialogComponent } from "./dialog.component";
|
import { DialogComponent } from "./dialog.component";
|
||||||
|
|
||||||
@ -17,8 +17,14 @@ export default {
|
|||||||
component: DialogComponent,
|
component: DialogComponent,
|
||||||
decorators: [
|
decorators: [
|
||||||
moduleMetadata({
|
moduleMetadata({
|
||||||
imports: [ButtonModule, SharedModule, IconButtonModule, TabsModule],
|
imports: [
|
||||||
declarations: [DialogTitleContainerDirective, DialogCloseDirective],
|
DialogModule,
|
||||||
|
ButtonModule,
|
||||||
|
SharedModule,
|
||||||
|
IconButtonModule,
|
||||||
|
TabsModule,
|
||||||
|
NoopAnimationsModule,
|
||||||
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: I18nService,
|
provide: I18nService,
|
||||||
@ -56,8 +62,7 @@ export const Default: Story = {
|
|||||||
render: (args: DialogComponent) => ({
|
render: (args: DialogComponent) => ({
|
||||||
props: args,
|
props: args,
|
||||||
template: `
|
template: `
|
||||||
<bit-dialog [dialogSize]="dialogSize" [loading]="loading" [disablePadding]="disablePadding">
|
<bit-dialog [dialogSize]="dialogSize" [title]="title" [subtitle]="subtitle" [loading]="loading" [disablePadding]="disablePadding">
|
||||||
<span bitDialogTitle>{{title}}</span>
|
|
||||||
<ng-container bitDialogContent>Dialog body text goes here.</ng-container>
|
<ng-container bitDialogContent>Dialog body text goes here.</ng-container>
|
||||||
<ng-container bitDialogFooter>
|
<ng-container bitDialogFooter>
|
||||||
<button bitButton buttonType="primary" [disabled]="loading">Save</button>
|
<button bitButton buttonType="primary" [disabled]="loading">Save</button>
|
||||||
@ -77,6 +82,7 @@ export const Default: Story = {
|
|||||||
args: {
|
args: {
|
||||||
dialogSize: "default",
|
dialogSize: "default",
|
||||||
title: "Default",
|
title: "Default",
|
||||||
|
subtitle: "Subtitle",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -117,8 +123,7 @@ export const ScrollingContent: Story = {
|
|||||||
render: (args: DialogComponent) => ({
|
render: (args: DialogComponent) => ({
|
||||||
props: args,
|
props: args,
|
||||||
template: `
|
template: `
|
||||||
<bit-dialog [dialogSize]="dialogSize" [loading]="loading" [disablePadding]="disablePadding">
|
<bit-dialog title="Scrolling Example" [dialogSize]="dialogSize" [loading]="loading" [disablePadding]="disablePadding">
|
||||||
<span bitDialogTitle>Scrolling Example</span>
|
|
||||||
<span bitDialogContent>
|
<span bitDialogContent>
|
||||||
Dialog body text goes here.<br>
|
Dialog body text goes here.<br>
|
||||||
<ng-container *ngFor="let _ of [].constructor(100)">
|
<ng-container *ngFor="let _ of [].constructor(100)">
|
||||||
@ -142,8 +147,7 @@ export const TabContent: Story = {
|
|||||||
render: (args) => ({
|
render: (args) => ({
|
||||||
props: args,
|
props: args,
|
||||||
template: `
|
template: `
|
||||||
<bit-dialog [dialogSize]="dialogSize" [disablePadding]="disablePadding">
|
<bit-dialog title="Tab Content Example" [dialogSize]="dialogSize" [disablePadding]="disablePadding">
|
||||||
<span bitDialogTitle>Tab Content Example</span>
|
|
||||||
<span bitDialogContent>
|
<span bitDialogContent>
|
||||||
<bit-tab-group>
|
<bit-tab-group>
|
||||||
<bit-tab label="First Tab">First Tab Content</bit-tab>
|
<bit-tab label="First Tab">First Tab Content</bit-tab>
|
||||||
|
Loading…
Reference in New Issue
Block a user