From e53718bc053e8cbd8951f881e60732bcd0fe902d Mon Sep 17 00:00:00 2001
From: alexisben <alex@noesya.coop>
Date: Mon, 28 Nov 2022 15:44:43 +0100
Subject: [PATCH] block chaper

---
 assets/sass/_theme/_utils.sass                |  6 +++++
 assets/sass/_theme/blocks/chapter.sass        | 27 ++++++++++++-------
 .../sass/_theme/design-system/typography.sass |  3 ++-
 3 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/assets/sass/_theme/_utils.sass b/assets/sass/_theme/_utils.sass
index d5b39ccf..ac141fc1 100644
--- a/assets/sass/_theme/_utils.sass
+++ b/assets/sass/_theme/_utils.sass
@@ -118,6 +118,12 @@
     $width: calc( (100% + #{$grid-gutter}) / 12 * #{$quantity-on-base} )
     @return #{$width}
 
+// This must be used for offset, inside columns
+@function col-offset($quantity, $base: 12)
+    $quantity-on-base: $quantity / $base * 12
+    $width: calc( (100% + #{$grid-gutter}) / 12 * #{$quantity-on-base} + #{$grid-gutter})
+    @return #{$width}
+
 @function col-outside-container($quantity)
     $responsive-grid-width: Min(100vw, (#{$grid-max-width}))
     @return calc((#{$responsive-grid-width} + #{$grid-gutter} * 2) / 12 * #{$quantity} - #{$grid-gutter} * 2)
diff --git a/assets/sass/_theme/blocks/chapter.sass b/assets/sass/_theme/blocks/chapter.sass
index db5ca7c9..70dd5a87 100644
--- a/assets/sass/_theme/blocks/chapter.sass
+++ b/assets/sass/_theme/blocks/chapter.sass
@@ -9,19 +9,28 @@
             @extend .small
     picture
         display: block
-        margin-top: $spacing1
     figcaption
         @extend .small
         margin-top: 0.5rem
-
+    .block-content
+        flex-direction: column
+        display: flex
+        .chapter
+            order: 2
+        figure
+            margin-bottom: $spacing1
     @include media-breakpoint-up(md)
+        @include in-page-with-sidebar
+            picture
+                margin-top: $spacing1
         @include in-page-without-sidebar
             .block-content
-                > *
+                flex-direction: row
+                align-items: center
+                .chapter
+                    order: 0
                     width: col(7)
-                    padding-right: $grid-gutter
-            &--with-image
-                .block-content
-                    align-items: center
-                    > *
-                        width: col(6)
+                figure
+                    width: col(4)
+                    margin-left: col-offset(1)
+                    margin-bottom: 0
diff --git a/assets/sass/_theme/design-system/typography.sass b/assets/sass/_theme/design-system/typography.sass
index 1591754d..11f667ca 100644
--- a/assets/sass/_theme/design-system/typography.sass
+++ b/assets/sass/_theme/design-system/typography.sass
@@ -100,7 +100,8 @@ h2, .h2
 p
     margin-top: 0
     margin-bottom: 0
-
+    + p
+        margin-top: $spacing0
 .meta
     font-family: $meta-font-family
     font-size: $meta-size
-- 
GitLab