From b1e6821155c074e2c9bd474ba57b0f3c39805d68 Mon Sep 17 00:00:00 2001 From: alexisben <alex@noesya.coop> Date: Fri, 23 Dec 2022 11:43:45 +0100 Subject: [PATCH] fix chapter figure columns --- assets/sass/_theme/blocks/chapter.sass | 9 ++++++--- layouts/partials/blocks/templates/chapter.html | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/assets/sass/_theme/blocks/chapter.sass b/assets/sass/_theme/blocks/chapter.sass index 9bab2d3e..43a0a5fc 100644 --- a/assets/sass/_theme/blocks/chapter.sass +++ b/assets/sass/_theme/blocks/chapter.sass @@ -5,7 +5,7 @@ margin-top: $spacing1 * @include small - picture + picture, img display: block figcaption @include small @@ -15,7 +15,7 @@ display: flex .text order: 2 - figure + figcaption margin-bottom: $spacing1 &--alt_background background: $block-chapter-layout-alt-background @@ -27,13 +27,16 @@ color: $block-chapter-layout-accent-color a @include link($block-chapter-layout-accent-color) - @include media-breakpoint-down(desktop) &--with-image &.block-chapter--alt_background, &.block-chapter--accent_background padding-top: half($grid-gutter-sm) @include media-breakpoint-up(desktop) @include in-page-with-sidebar + figure + max-width: col(6, 8) + &.image-portrait + max-width: col(4, 8) &--alt_background, &--accent_background background: none .chapter .text diff --git a/layouts/partials/blocks/templates/chapter.html b/layouts/partials/blocks/templates/chapter.html index b8075a6f..9a72217d 100644 --- a/layouts/partials/blocks/templates/chapter.html +++ b/layouts/partials/blocks/templates/chapter.html @@ -3,9 +3,11 @@ {{- $title := .block.title -}} {{- $layout := .block.data.layout | default "no_background" -}} {{- $class := "block block-chapter" -}} +{{- $image_class := "" -}} {{- with .block.data -}} {{ if .image }} {{- $class = printf "%s block-chapter--with-image" $class -}} + {{- $image_class = printf "image-%s" (partial "GetImageDirection" .image) -}} {{ end }} {{- $layout_class := printf "block-chapter--%s" $layout -}} {{- $class = printf "%s %s" $class $layout_class -}} @@ -36,7 +38,7 @@ {{ end -}} </div> {{ if .image }} - <figure> + <figure class="{{- $image_class -}}"> {{ partial "commons/image.html" (dict "image" .image -- GitLab