{% load djblets_utils i18n %}

{% spaceless %}
{%  definevar "banner_attrs" strip %}
{%   block banner_attrs %}{{banner_attrs|default:""}}{% endblock %}
{%  enddefinevar %}


{%  definevar "banner_can_close" strip %}
{%   block banner_can_close %}{{banner_can_close|default_if_none:False}}{% endblock %}
{%  enddefinevar %}


{%  definevar "banner_classes" strip %}
rb-c-page-banner
{%   block banner_classes %}{{banner_classes|default:""}}{% endblock %}
{%  enddefinevar %}


{%  definevar "banner_header" strip %}
{%   block banner_header %}{{banner_header|default:""}}{% endblock %}
{%  enddefinevar %}


{%  definevar "banner_id" strip %}
{%   block banner_id %}
{%    if banner_id %}
{{banner_id}}
{%    else %}
{%     unique_id "page_banner_" %}
{%    endif %}
{%   endblock %}
{%  enddefinevar %}


{%  definevar "banner_scripts" strip %}
{%   block banner_scripts %}
{%    if banner_scripts_template_name %}
{%     include banner_scripts_template_name %}
{%    elif banner_scripts %}
{{banner_scripts}}
{%    endif %}
{%   endblock %}
{%  enddefinevar %}


{%  block component %}
<div id="{{banner_id}}" class="{{banner_classes}}" role="region"
{%   if banner_aria_label %}
     aria-label="{{banner_aria_label}}"
{%   else %}
     aria-labelledby="{{banner_id}}_header"
{%   endif %}
     {{banner_attrs}}>
 <div class="rb-c-page-banner__content">
{%   if banner_header %}
  <h2 id="{{banner_id}}_header"
      class="rb-c-page-banner__header">{{banner_header}}</h2>
{%   endif %}
{%   block banner_content %}{% endblock %}
 </div>
{%  if banner_can_close|lower == "true" %}
 <a id="{{banner_id}}_close"
    class="rb-c-page-banner__close ink-i-close" role="button"
    href="#" tabindex="0"
    aria-label="{% trans "Dismiss the banner" %}"
    title="{% trans "Dismiss the banner" %}"></a>
{%  endif %}
{{banner_scripts}}
</div>
{%  endblock component %}
{% endspaceless %}
