Provide alternate style for titlebar title paragraphs

currently, it loses any image or subtitle, but could probably bring those back.

Do style values the right way-- not as content, but grabbed from the entity.
This commit is contained in:
benjamin melançon 2018-11-13 23:40:47 -05:00
parent ef3f750fb4
commit c606289fc4

View file

@ -41,19 +41,22 @@
{%
set classes = [
'hero',
'hero-project',
'paragraph',
'paragraph--type--' ~ paragraph.bundle|clean_class,
view_mode ? 'paragraph--view-mode--' ~ view_mode|clean_class,
not paragraph.isPublished() ? 'paragraph--unpublished'
]
%}
{% if content.field_style_color %}
{% set classes = classes|merge(['is-'~content.field_style_color|render|trim]) %}
{% if paragraph.field_style_color %}
{% set classes = classes|merge(['is-'~paragraph.field_style_color.value]) %}
{% endif %}
{% if paragraph.field_style_titlebar is empty %}
{% set classes = classes|merge(['hero-project']) %}
{% endif %}
{% block paragraph %}
<section{{ attributes.addClass(classes) }}>
{% block content %}
{% if paragraph.field_style_titlebar is empty %}
<div class="container">
<div class="hero-image">
{{ content.field_image }}
@ -62,6 +65,18 @@
{{ content.field_title }}
{{ content.field_subtitle }}
</div>
</div>
{% else %}
<div class="hero-body">
<div class="container">
<div class="titlebar">
<div class="titlebar_title">
<h1 class="title is-2">{{ content.field_title }}</h1>
</div>
</div>
</div>
</div>
{% endif %}
{% endblock %}
</section>
{% endblock paragraph %}