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