Copy environment

Browser Notification

<div class="notification sg-animate-notification ">
    <div class="notification__content text">
        You are using an outdated browser. Please upgrade your browser to improve your experience and security.
    </div>
    <div class="notification__action-list">

        <a href="https://google.com" class="button button--text notification__action " target="_blank">
            <span class="button__inner">
                <span class="button__text">Learn more</span>
            </span>
        </a>

        <button type="button" class="button button--text notification__action notification__action--close">
            <span class="button__inner">
                <span class="button__text">OK</span>
            </span>
        </button>
    </div>
</div>
{% include '@notification' with { modifier: modifier, class: class, data: data } %}
{
  "language": "en-US",
  "modifier": "sg-animate-notification",
  "data": {
    "content": "You are using an outdated browser. Please upgrade your browser to improve your experience and security.",
    "actions": [
      {
        "link": "https://google.com",
        "text": "Learn more",
        "attributes": "target=\"_blank\""
      }
    ],
    "button": {
      "text": "OK"
    }
  }
}
  • Content:
    import Helpers from '../../helpers/helpers';
    import Notification, { INotification } from '../notification/notification';
    
    export default class BrowserNotification extends Notification {
        static initSelector: string = '.browser-notification';
    
        public static get shouldShow(): boolean {
            const ieVer: number | boolean = Helpers.isIE;
    
            return window.sessionStorage.getItem('gotoandplay_old_browser') !== 'accepted' && ieVer && ieVer <= 11;
        }
    
        public static render(data: INotification, className: string = ''): JQuery {
            return super.render(data, ['browser-notification', className].join(' '));
        }
    
        remove(): void {
            window.sessionStorage.setItem('gotoandplay_old_browser', 'accepted');
    
            super.remove();
        }
    }
    
  • URL: /components/raw/browser-notification/browser-notification.ts
  • Filesystem Path: src/patterns/components/notifications/browser-notification/browser-notification.ts
  • Size: 767 Bytes
  • Handle: @browser-notification--default
  • Filesystem Path: src/patterns/components/notifications/browser-notification/browser-notification.twig
  • References (1): @notification