Skip to content
Snippets Groups Projects
Commit ca04d6c7 authored by Martin Leblanc's avatar Martin Leblanc
Browse files

ISTWCMS-6012: Correct image caption alignment

parent 3efcf3ed
No related branches found
No related tags found
1 merge request!78istwcms 6012 m26lebla correct image caption
......@@ -5,8 +5,22 @@
width: 100%;
img{
display: block;
max-width: 100%;
}
&__figure{
display: table;
min-width: 15rem;
}
&__caption{
caption-side: bottom;
display: table-caption;
}
&__sized-image {
&--original{
img {
margin: 0 auto;
}
}
&--center {
align-self: center;
}
......
{% set image_class = ['uw-image__figure'] %}
{% if image.type == 'full' %}
{% set image_class = 'uw-image__full-width' %}
{% set image_class = image_class | merge (['uw-image__full-width']) %}
{% else %}
{% set image_class = 'uw-image__sized-image uw-image__sized-image--' ~ image.alignment %}
{% if image.sized_type %}
{% set image_class = image_class | merge (
['uw-image__sized-image',
'uw-image__sized-image--' ~ image.alignment,
'uw-image__sized-image--' ~ image.sized_type,
]
)%}
{% else %}
{% set image_class = image_class | merge (
['uw-image__sized-image',
'uw-image__sized-image--' ~ image.alignment,
]
) %}
{% endif %}
{% endif %}
<div class="uw-image">
<div class="uw-image__wrapper {{ image_class }}">
<figure {{ attributes.addClass(image_class) }}>
{% if image.type == 'full' %}
{% include '@components/responsive-image/responsive-image.twig' with {
'sources': image.image.sources,
'img_element': image.image.img_element['#uri'],
......@@ -18,11 +29,11 @@
<img src="{{ image.image.url }}" width="{{ image.image.width }}" height="{{ image.image.height }}" alt="{{ image.alt }}" />
{% endif %}
{% if image.caption %}
<div class="uw-image__caption" {% if image.image.width %} style="width:{{ image.image.width }}px;"{% endif %}>
<figcaption class="uw-image__caption" {% if image.image.width %} style="width:{{ image.image.width }}px;"{% endif %}>
{% include '@components/caption/caption.twig' with {
'caption': image.caption
} %}
</div>
</figcaption>
{% endif %}
</div>
</figure>
</div>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment