Commit 896172e9 authored by Eric Bremner's avatar Eric Bremner

Trying to make generic tabs

parent 5d53e52c
{% set button_modifier_classes -%}
button button--large {{ modifier_classes }}
{%- endset %}
<div class="uw-tabs">
<div class="uw-tab" role="tablist" aria-label="Multi-tab-list">
{% for type, list in lists %}
<button role="tab" class="uw-tablinks {{ button_modifier_classes }} " {% if loop.index == 1 %} aria-selected="true" {% else %} aria-selected="false" {% endif %} aria-controls="{{ type }}" id="tab-{{ loop.index }}" tabindex="0">{{ type }}</button>
{% endfor %}
</div>
{% set content_list = [] %}
{% for type, list in lists %}
<h2 class="hide-js"> {{ type }}</h2>
<div id="{{ type }}" class="uw-tabcontent" role="tabpanel" tabindex="0" aria-labelledby="tab-{{ loop.index }}" {% if loop.index > 1 %} hidden {% endif %} >
{% for content in list %}
{% set content_list = content_list|merge([type]) %}
{% endfor %}
{% if type == 'Blog' %}
{{ dd(content_list) }}
{% embed '@components/tabs/tabs.twig' with {
'content_list': content_list
} %}
{% for type, list in lists %}
{% block content~{{ type }} %}
{% if type == 'Blog' %}
{% include '@components/teaser/teaser--blog/teaser--blog.twig' with {
'title': content.title,
'url': content.url,
......@@ -27,7 +25,7 @@
'tags': content.tags,
'content': content.content
} %}
{% endif %}
{% endif%}
{% if type == 'News' %}
{% include '@components/teaser/teaser--news/teaser--news.twig' with {
......@@ -54,6 +52,8 @@
} %}
{% endif %}
{% endfor %}
</div>
{% endfor %}
{% endblock %}
{% endfor %}
{% endembed %}
\ No newline at end of file
......@@ -250,4 +250,9 @@ lists:
img_element: '../../../../source/images/president/president_xlarge.jpg'
alt: 'Alternative text for blog teaser photo'
content: |-
<p>This is the summary, which can contain <abbr title="Hyper Text Markup Language">HTML</abbr> markup. It should be 600 characters or less.Ea sit vide commodo ancillae, pro eu quidam ancillae offendit. Odio ferri officiis an his, sit id causae partiendo accusamus, has discere expetendis ne. Per at wisi homero voluptaria, vis vidit ornatus vituperatoribus no. Labores maiestatis mei ad, cum cu exerci appareat.</p>
\ No newline at end of file
<p>This is the summary, which can contain <abbr title="Hyper Text Markup Language">HTML</abbr> markup. It should be 600 characters or less.Ea sit vide commodo ancillae, pro eu quidam ancillae offendit. Odio ferri officiis an his, sit id causae partiendo accusamus, has discere expetendis ne. Per at wisi homero voluptaria, vis vidit ornatus vituperatoribus no. Labores maiestatis mei ad, cum cu exerci appareat.</p>
content_list:
- blogs
- events
- news
\ No newline at end of file
{% if tabs %}
<nav class="tabs {{ modifier_classes }}" role="navigation">
<h2 class="visually-hidden">{{ heading|default('Primary tabs'|t) }}</h2>
<ul class="tabs__items">
{% for tab in tabs %}
{% set active_class = tab.active ? 'is-active' : '' %}
<li class="tabs__item {{ active_class }}">
{% block link %}
<a href="{{ tab.url }}" class="tabs__link {{ active_class }}">
{{ tab.text }}
{% if tab.active %}
<span class="visually-hidden">{{ active_label|default('(active tab)') }}</span>
{% endif %}
</a>
{% endblock link %}
</li>
{% set button_modifier_classes -%}
button button--large {{ modifier_classes }}
{%- endset %}
<div class="uw-tabs">
<div class="uw-tab" role="tablist" aria-label="Multi-tab-list">
{% for type in content_list %}
<button role="tab" class="uw-tablinks {{ button_modifier_classes }} " {% if loop.index == 1 %} aria-selected="true" {% else %} aria-selected="false" {% endif %} aria-controls="{{ type }}" id="tab-{{ loop.index }}" tabindex="0">{{ type }}</button>
{% endfor %}
</ul>
</nav>
{% endif %}
</div>
{% for type in content_list %}
<h2 class="hide-js"> {{ type }}</h2>
<div id="{{ type }}" class="uw-tabcontent" role="tabpanel" tabindex="0" aria-labelledby="tab-{{ loop.index }}" {% if loop.index > 1 %} hidden {% endif %} >
{% block content-{{ type }} %}
Content content content
{% endblock %}
</div>
{% endfor %}
</div>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment