Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: emit scale-close on notification close #1066

Merged
merged 2 commits into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,19 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

import { Component, h, Host, Prop, Element, Method } from '@stencil/core';
import {
Component,
h,
Host,
Prop,
Element,
Method,
Event,
EventEmitter,
} from '@stencil/core';
import classNames from 'classnames';
import statusNote from '../../utils/status-note';
import { emitEvent } from '../../utils/utils';

@Component({
tag: 'scale-notification-banner',
Expand All @@ -28,6 +38,8 @@ export class NotificationBanner {
@Prop() autoHide?: boolean = false;
@Prop() autoHideDuration?: number = 3000;
@Prop() href: string;
/** Fires when the notification banner has been dismissed */
@Event({ eventName: 'scale-close' }) scaleClose: EventEmitter<void>;

hasSlotText?: boolean;
hasSlotLink?: boolean;
Expand Down Expand Up @@ -97,6 +109,7 @@ export class NotificationBanner {

close = () => {
this.opened = false;
emitEvent(this, 'scaleClose');
};

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
| `variant` | `variant` | | `"error" \| "informational" \| "success" \| "warning"` | `'informational'` |


## Events

| Event | Description | Type |
| ------------- | ----------------------------------------------------- | ------------------- |
| `scale-close` | Fires when the notification banner has been dismissed | `CustomEvent<void>` |


## Methods

### `open() => Promise<void>`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,19 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

import { Component, h, Host, Prop, Element, Method } from '@stencil/core';
import {
Component,
h,
Host,
Prop,
Element,
Method,
Event,
EventEmitter,
} from '@stencil/core';
import classNames from 'classnames';
import statusNote from '../../utils/status-note';
import { emitEvent } from '../../utils/utils';

@Component({
tag: 'scale-notification-message',
Expand All @@ -27,6 +37,8 @@ export class NotificationMessage {
@Prop({ reflect: true }) opened: boolean;
@Prop() autoHide?: boolean = false;
@Prop() autoHideDuration?: number = 3000;
/** Fires when the notification message has been dismissed */
@Event({ eventName: 'scale-close' }) scaleClose: EventEmitter<void>;

hasSlotText: boolean;

Expand Down Expand Up @@ -93,6 +105,7 @@ export class NotificationMessage {

close = () => {
this.opened = false;
emitEvent(this, 'scaleClose');
};

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
| `variant` | `variant` | | `"error" \| "informational" \| "success" \| "warning"` | `'informational'` |


## Events

| Event | Description | Type |
| ------------- | ------------------------------------------------------ | ------------------- |
| `scale-close` | Fires when the notification message has been dismissed | `CustomEvent<void>` |


## Methods

### `open() => Promise<void>`
Expand Down