Sha256: 7d1973a8ad9950b7b6c5c094fad4f85203399ffb6483f645b4c7543c7fcf970d

Contents?: true

Size: 1.91 KB

Versions: 16

Compression:

Stored size: 1.91 KB

Contents

{%- if params.type == "success" %}
  {% set successBanner = true %}
{% endif %}

{%- if successBanner %}
  {% set typeClass = "govuk-notification-banner--" + params.type %}
{% endif %}

{% if params.role %}
  {% set role = params.role %}
{% elif successBanner %}
  {# If type is success, add `role="alert"` to prioritise the information in the notification banner to users of assistive technologies #}
  {% set role = "alert" %}
{% else %}
  {# Otherwise add `role="region"` to make the notification banner a landmark to help users of assistive technologies to navigate to the banner #}
  {% set role = "region" %}
{% endif %}

{%- if params.titleHtml %}
  {% set title = params.titleHtml | safe %}
{%- elif params.titleText %}
  {% set title = params.titleText %}
{%- elif successBanner %}
  {% set title = "Success" %}
{%- else %}
  {% set title = "Important" %}
{%- endif -%}

<div class="govuk-notification-banner{% if typeClass %} {{ typeClass }}{% endif %}{% if params.classes %} {{ params.classes }}{% endif %}" role="{{ role }}"
  aria-labelledby="{{ params.titleId | default('govuk-notification-banner-title')}}"
  data-module="govuk-notification-banner"
  {%- if params.disableAutoFocus %} data-disable-auto-focus="true"{% endif %}
  {%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
  <div class="govuk-notification-banner__header">
    <h{{ params.titleHeadingLevel | default(2) }} class="govuk-notification-banner__title" id="{{ params.titleId | default('govuk-notification-banner-title') }}" >
      {{ title }}
    </h{{ params.titleHeadingLevel | default(2) }}>
  </div>
  <div class="govuk-notification-banner__content">
    {%- if caller or params.html -%}
      {{ caller() if caller else params.html | safe }}
    {%- elif params.text -%}
      {# Set default style for single line content #}
      <p class="govuk-notification-banner__heading">{{ params.text }}</p>
    {%- endif -%}
  </div>
</div>

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
govuk_publishing_components-32.1.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-32.0.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-31.2.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-31.1.2 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-31.1.1 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-31.1.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-31.0.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-30.7.3 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-30.7.2 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-30.7.1 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-30.7.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-30.6.1 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-30.6.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-30.5.2 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-30.5.1 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-30.5.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk