Sha256: 1c49cb079fb0572fcbeba3e04ea0fe1c4d5bd1f6ec2ef09b0c15e9d58a52a48e

Contents?: true

Size: 1.88 KB

Versions: 144

Compression:

Stored size: 1.88 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 params.html -%}
      {{ 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

144 entries across 144 versions & 2 rubygems

Version Path
defra_ruby_template-3.15.1 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
defra_ruby_template-3.15.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-30.4.1 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-30.4.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-30.3.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-30.2.1 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-30.2.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-30.1.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-30.0.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-29.15.3 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-29.15.2 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-29.15.1 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-29.15.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-29.14.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-29.13.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-29.12.1 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-29.12.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-29.11.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-29.10.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk
govuk_publishing_components-29.9.0 node_modules/govuk-frontend/govuk/components/notification-banner/template.njk