Europa Component Library

Link blocks

Link block component displays a list of links, with an optional title. It is used for instance in the dropdown component.

{#
  - "title" (string): optional title of the link block (default: '')
  - "links" (array): [
    "href" (string): target of the link
    "label" (string): label of the link
  ]
  - "extra_classes" (string): extra CSS classes to be added
  - "extra_attributes" (array): extra attributes classes (optional, format: [{ 'name': 'name_of_the_attribute', 'value': 'value_of_the_attribute'}])
#}

{% set title = title|default('') %}

{# Internal properties #}

{% set _css_class = 'ecl-link-block' %}
{% set _extra_attributes = '' %}

{# Internal logic - Process properties #}

{% if extra_classes is defined %}
  {% set _css_class = _css_class ~ ' ' ~ extra_classes %}
{% endif %}

{% if extra_attributes is defined %}
  {% for attr in extra_attributes %}
    {% set _extra_attributes = _extra_attributes ~ ' ' ~ attr.name ~ '="' ~ attr.value ~ '"' %}
  {% endfor %}
{% endif %}

<div class="{{ _css_class }}" {{ _extra_attributes|raw }}>
  {% if title != '' %}
    <div class="ecl-link-block__title">{{ title }}</div>
  {% endif %}

  <ul class="ecl-link-block__list">
    {% for link in links %}
    <li class="ecl-link-block__item">
      {% include '@ec-europa/ecl-links' with {
        'extra_classes': 'ecl-link-block__link',
        'variant': 'standalone',
        }|merge(link)
      %}
    </li>
    {% endfor %}
  </ul>
</div>
/* Standalone block of links */
{
  "links": [
    {
      "href": "#",
      "label": "European Commission"
    },
    {
      "href": "#",
      "label": "Priorities"
    },
    {
      "href": "#",
      "label": "Jobs, Growth and Investment"
    }
  ]
}

/* Block of links with title */
{
  "title": "More information",
  "links": [
    {
      "href": "#",
      "label": "European Commission"
    },
    {
      "href": "#",
      "label": "Priorities"
    },
    {
      "href": "#",
      "label": "Jobs, Growth and Investment"
    }
  ]
}

<!-- Standalone block of links -->
<div class="ecl-link-block">

  <ul class="ecl-link-block__list">
    <li class="ecl-link-block__item">

      <a class="ecl-link ecl-link--standalone ecl-link-block__link" href="#">European Commission</a>
    </li>
    <li class="ecl-link-block__item">

      <a class="ecl-link ecl-link--standalone ecl-link-block__link" href="#">Priorities</a>
    </li>
    <li class="ecl-link-block__item">

      <a class="ecl-link ecl-link--standalone ecl-link-block__link" href="#">Jobs, Growth and Investment</a>
    </li>
  </ul>
</div>

<!-- Block of links with title -->
<div class="ecl-link-block">
  <div class="ecl-link-block__title">More information</div>

  <ul class="ecl-link-block__list">
    <li class="ecl-link-block__item">

      <a class="ecl-link ecl-link--standalone ecl-link-block__link" href="#">European Commission</a>
    </li>
    <li class="ecl-link-block__item">

      <a class="ecl-link ecl-link--standalone ecl-link-block__link" href="#">Priorities</a>
    </li>
    <li class="ecl-link-block__item">

      <a class="ecl-link ecl-link--standalone ecl-link-block__link" href="#">Jobs, Growth and Investment</a>
    </li>
  </ul>
</div>

  • Content:
    /**
     * ECL Link blocks
     * @define link-block
     */
    
    .ecl-link-block {
      background-color: map-get($ecl-colors, 'grey-5');
      margin: 0;
      padding: map-get($ecl-spacing, 'xxxs') 0;
    }
    
    .ecl-link-block__title {
      color: map-get($ecl-colors, 'blue-110');
      font-size: map-get($ecl-font-size, 's');
      font-weight: 600;
      padding: map-get($ecl-spacing, 'xxs') map-get($ecl-spacing, 's')
        map-get($ecl-spacing, 'xxs');
    }
    
    .ecl-link-block__list {
      font-size: map-get($ecl-font-size, 's');
      list-style: none;
      margin: 0;
      padding-left: 0;
    }
    
    .ecl-link-block__item {
      white-space: nowrap;
    }
    
    .ecl-link-block__link {
      display: block;
      line-height: 2;
      padding: 0 map-get($ecl-spacing, 's');
    }
    
  • URL: /components/raw/ecl-link-blocks/ecl-link-blocks.scss
  • Filesystem Path: framework/components/ecl-link-blocks/ecl-link-blocks.scss
  • Size: 690 Bytes
  • Handle: @ec-europa/ecl-link-blocks
  • Tags: molecule
  • Preview:
  • Filesystem Path: framework/components/ecl-link-blocks/ecl-link-blocks.twig