SU-SWS/decanter

View on GitHub
core/src/templates/components/lockup/lockup.twig

Summary

Maintainability
Test Coverage
{#
/**
 * @file
 * Lockup Component.
 *
 * A lockup with the Stanford wordmark logo and department/site name. It links to the homepage of the department/unit.
 *
 * Default class for the lockup:
 * - .su-lockup - Lockup with one line to the right of the wordmark.
 *
 * Available variants for the lockup:
 * - .su-lockup--option-a
 * - .su-lockup--option-b
 * - .su-lockup--option-c
 * - .su-lockup--option-d
 * - .su-lockup--option-e
 * - .su-lockup--option-f
 * - .su-lockup--option-g
 * - .su-lockup--option-h
 * - .su-lockup--option-i
 * - .su-lockup--option-j
 * - .su-lockup--option-k
 * - .su-lockup--option-l
 * - .su-lockup--option-m
 * - .su-lockup--option-n
 * - .su-lockup--option-o
 * - .su-lockup--option-p
 * - .su-lockup--option-q
 * - .su-lockup--option-r
 * - .su-lockup--option-s
 * - .su-lockup--option-t
 *
 * Available variables:
 * - attributes: For additional HTML attributes not already provided.
 * - modifier_class: Additional css classes to change look and behaviour.
 * - link: The URL that the lockup links to.
 * - line1: Line 1 of the unit/site name text (to the right of the wordmark).
 * - line2: Line 2 of the unit/site name text (to the right of the wordmark).
 * - line3: Line 3 of the unit/site name text (to the right of the wordmark).
 * - line4: Line 4 of the unit/site name text (under the wordmark).
 * - line5: Line 5 of the unit/site name text (at the bottom part of the lockup).
 * - region_attributes: Attributes for each region variable
 */
#}
<div {{ attributes }} class="su-lockup {{ modifier_class }}">
  {% if link is not empty %}
  <a href="{{ link }}" {{ link_attributes }}>
  {% endif %}
  {#- Cell container #1 -#}
  <div class="su-lockup__cell1">
    {% block cell1 %}
      <div class="su-lockup__wordmark-wrapper">
        <span class="su-lockup__wordmark">Stanford</span>
        {% if line4 is not empty %}
          <span class="su-lockup__line4" {{ region_attributes.line4 }}>{{ line4 }}</span>
        {% endif %}
      </div>
    {% endblock %}
  </div>

  {#- Cell container #2 -#}
  {% block cell2 %}
  {% if line1 is not empty or line2 is not empty or line3 is not empty %}
  <div class="su-lockup__cell2">
    {% if line1 is not empty %}
    <span class="su-lockup__line1" {{ region_attributes.line1 }}>{{ line1 }}</span>
    {% endif %}

    {% if line2 is not empty %}
    <span class="su-lockup__line2" {{ region_attributes.line2 }}>{{ line2 }}</span>
    {% endif %}

    {% if line3 is not empty %}
    <span class="su-lockup__line3" {{ region_attributes.line3 }}>{{ line3 }}</span>
    {% endif %}
  </div>
  {% endif %}
  {% endblock %}

  {#- Line 5 of Site Name - Optional -#}
  {% if line5 is not empty %}
    <div class="su-lockup__line5 {{ region_attributes.line5 }}">
      {%- block cell3 -%}
      {{- line5 -}}
      {%- endblock -%}
    </div>
  {% endif %}
  {% if link is not empty %}
    </a>
  {% endif %}
</div>