From 536ba06c72e0af23b4a05653af87a5d5fb41faaf Mon Sep 17 00:00:00 2001 From: jmarkowski Date: Tue, 11 Jun 2019 16:41:42 +0200 Subject: [PATCH] fix: Add min-width option on alerts with default value (#863) * fix: Add min-width option on alerts with default value * Change docs 400px alert min-width to 300px * Remove minWidth check --- .../examples/alert-component-as-content-example.component.ts | 1 + library/src/lib/alert/alert-utils/alert-config.ts | 3 +++ library/src/lib/alert/alert.component.ts | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/docs/app/documentation/component-docs/alert/examples/alert-component-as-content-example.component.ts b/docs/app/documentation/component-docs/alert/examples/alert-component-as-content-example.component.ts index 5924db9898f..26da6de8167 100644 --- a/docs/app/documentation/component-docs/alert/examples/alert-component-as-content-example.component.ts +++ b/docs/app/documentation/component-docs/alert/examples/alert-component-as-content-example.component.ts @@ -14,6 +14,7 @@ export class AlertComponentAsContentExampleComponent { openFromComponent() { this.alertService.open(AlertContentComponent, { type: 'warning', + minWidth: '300px', mousePersist: true, duration: 7500, data: { diff --git a/library/src/lib/alert/alert-utils/alert-config.ts b/library/src/lib/alert/alert-utils/alert-config.ts index d20c011421b..951fef82d58 100644 --- a/library/src/lib/alert/alert-utils/alert-config.ts +++ b/library/src/lib/alert/alert-utils/alert-config.ts @@ -16,6 +16,9 @@ export class AlertConfig { /** Width of the alert. */ width?: string = '33vw'; + /** Minimum width of the alert. */ + minWidth?: string = '300px'; + /** Data being injected into the child component or template. */ data?: any; diff --git a/library/src/lib/alert/alert.component.ts b/library/src/lib/alert/alert.component.ts index 8104c441782..7254be756c9 100644 --- a/library/src/lib/alert/alert.component.ts +++ b/library/src/lib/alert/alert.component.ts @@ -34,6 +34,7 @@ let alertUniqueId: number = 0; '[attr.aria-labelledby]': 'ariaLabelledBy', '[attr.aria-label]': 'ariaLabel', '[style.width]': 'width', + '[style.min-width]': 'minWidth', 'role': 'alert', '[attr.id]': 'id', '[@fadeAlertNgIf]': '' @@ -85,6 +86,10 @@ export class AlertComponent extends AbstractFdNgxClass implements OnInit, AfterV @Input() width: string; + /** Minimum width of the alert. */ + @Input() + minWidth: string; + /** Alternative way of passing in a message to the alert. */ @Input() message: string;