Copy environment

Cookie Notification

<div class="notification cookie-notification ">
    <div class="notification__content text">
        We use Cookies to improve your web experience. Read our <a href="#"> cookie policy </a>
    </div>
    <div class="notification__action-list">

        <button type="button" class="button button--text notification__action notification__action--close">
            <span class="button__inner">
                <span class="button__text">ACCEPT</span>
            </span>
        </button>
    </div>
</div>
{% include '@notification' with { modifier: 'cookie-notification', class: class, data: data } %}
{
  "language": "en-US",
  "data": {
    "content": "We use Cookies to improve your web experience. Read our <a href=\"#\"> cookie policy </a>",
    "button": {
      "text": "ACCEPT"
    }
  }
}
  • Content:
    import Cookie from '../../../modules/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: 676 Bytes
  • Handle: @cookie-notification--default
  • Filesystem Path: src/patterns/components/notifications/cookie-notification/cookie-notification.twig
  • References (1): @notification