public notify()

in src/components/notification.ts [40:98]


  public notify (): void {
    this.notificationOverlay = new Overlay({
      referencePoint: {
        left: Math.max(document.documentElement.clientWidth ?? 0, window.innerWidth ?? 0),
        top: this.getNextCalculatedTop(),
      },
      dimOutside: false,
      closeOnOutsideClick: false,
      horizontalDirection: OverlayHorizontalDirection.TO_LEFT,
      verticalDirection: OverlayVerticalDirection.TO_BOTTOM,
      onClose: this.props.onNotificationHide,
      children: [
        {
          type: 'div',
          testId: testIds.notification.wrapper,
          classNames: [
            'mynah-notification',
            this.props.onNotificationClick != null ? 'mynah-notification-clickable' : '',
          ],
          events: {
            click: e => {
              cancelEvent(e);
              if (this.props.onNotificationClick != null) {
                this.props.onNotificationClick();
                this.notificationOverlay?.close();
              }
            },
          },
          children: [
            new Icon({ icon: this.type.toString() as MynahIcons }).render,
            {
              type: 'div',
              classNames: [ 'mynah-notification-container' ],
              children: [
                {
                  type: 'h3',
                  testId: testIds.notification.title,
                  classNames: [ 'mynah-notification-title' ],
                  children: [ this.props.title ?? '' ],
                },
                {
                  type: 'div',
                  testId: testIds.notification.content,
                  classNames: [ 'mynah-notification-content' ],
                  children: this.getChildren(this.props.content),
                },
              ],
            },
          ],
        },
      ],
    });

    if (this.duration !== -1) {
      setTimeout(() => {
        this.notificationOverlay?.close();
      }, this.duration);
    }
  }