Copy environment

Cookie Notification

<div class="notification  cookie-notification">
    <div class="notification__content">
        Our website uses cookies to make your browsing experience better. By using our site you agree to our <a href='#' class="text">Cookie Policy</a>.
    </div>
    <div class="notification__action-list">

        <button type="button" class="button button--white notification__action notification__action--close ">

            <span class="button__inner" data-text="I Agree">
                <span class="button__text">
                    I Agree

                </span>
            </span>
        </button>
    </div>
</div>
{% include '@notification' with { modifier: '', class: class, data: data } %}
{
  "language": "en-US",
  "class": "cookie-notification",
  "data": {
    "content": "Our website uses cookies to make your browsing experience better.  By using our site you agree to our <a href='#' class=\"text\">Cookie Policy</a>.",
    "button": {
      "text": "I Agree"
    }
  }
}
  • Content:
    import Cookie from '@cookie';
    import Notification, { INotification } from '@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: 637 Bytes
  • Handle: @cookie-notification--default
  • Filesystem Path: src/patterns/components/notifications/cookie-notification/cookie-notification.twig
  • References (1): @notification