Copy environment

Cookie Notification

<div class="notification  " role="status" aria-live="polite">
    <div class="notification__content text">
        By continuing to use this website, you consent to the use of cookies in accordance with our <a href="#">Cookie Policy.</a>
    </div>
    <div class="notification__action-list">

        <button type="button" class="button button--tiny notification__action">
            <span class="button__inner">
                <span class="button__text">OK Continue</span>
            </span>
        </button>
    </div>
</div>
{% include '@notification' with { modifier: '', class: class, data: data } %}
{
  "language": "en-US",
  "data": {
    "content": "By continuing to use this website, you consent to the use of cookies in accordance with our <a href=\"#\">Cookie Policy.</a>",
    "button": {
      "text": "OK Continue",
      "modifier": "button--tiny"
    }
  }
}
  • Content:
    import Cookie from '../../../utilities/cookie/cookie';
    import Notification, { INotification } from '../notification/notification';
    
    export default class CookieNotification extends Notification {
        static initSelector: string = '.cookie-notification';
    
        public static get shouldShow(): boolean {
            return Cookie.get('gotoandplay_cookie_agreement') !== 'accepted';
        }
    
        public static render(data: INotification, className: string = ''): JQuery {
            return super.render(data, ['cookie-notification', className].join(' '));
        }
    
        remove(): void {
            Cookie.set('gotoandplay_cookie_agreement', 'accepted', 365 * 24);
    
            super.remove();
        }
    }
    
  • URL: /components/raw/cookie-notification/cookie-notification.ts
  • Filesystem Path: src/patterns/components/notifications/cookie-notification/cookie-notification.ts
  • Size: 677 Bytes
  • Handle: @cookie-notification--default
  • Filesystem Path: src/patterns/components/notifications/cookie-notification/cookie-notification.twig
  • References (1): @notification