From dfe5376bb78b424090b5304a3b20bff4a71b8d99 Mon Sep 17 00:00:00 2001
From: Olivia206 <olivia.simonet206@gmail.com>
Date: Fri, 3 May 2024 12:59:06 +0200
Subject: [PATCH] use mixin instead of class for alternate layout

---
 assets/sass/_theme/blocks/pages.sass         |  2 +-
 assets/sass/_theme/blocks/posts.sass         |  5 +---
 assets/sass/_theme/design-system/layout.sass | 25 +-----------------
 assets/sass/_theme/utils/blocks.sass         | 27 +++++++++++++++++++-
 4 files changed, 29 insertions(+), 30 deletions(-)

diff --git a/assets/sass/_theme/blocks/pages.sass b/assets/sass/_theme/blocks/pages.sass
index faed9ba5..7055315f 100644
--- a/assets/sass/_theme/blocks/pages.sass
+++ b/assets/sass/_theme/blocks/pages.sass
@@ -230,11 +230,11 @@
         .top
             @include top-flex
         .alternate
+            @include alternate
             article 
                 position: relative
                 display: flex
                 flex-direction: column
-                width: columns(4)
                 a
                     @include stretched-link
                 .media 
diff --git a/assets/sass/_theme/blocks/posts.sass b/assets/sass/_theme/blocks/posts.sass
index 7fe172e4..407605e3 100644
--- a/assets/sass/_theme/blocks/posts.sass
+++ b/assets/sass/_theme/blocks/posts.sass
@@ -261,8 +261,7 @@
                     margin-top: 0
 
     &--alternate .alternate
-        .post .media img
-            aspect-ratio: unset
+        @include alternate
         @include media-breakpoint-up(desktop)
             &.without-images
                 .right
@@ -275,8 +274,6 @@
                         margin-top: -5%
                     + .post:not(.portrait, .square, .landscape)
                         margin-top: -3%
-            article
-                width: columns(4)
         @include media-breakpoint-down(desktop)
             .post 
                 .post-meta
diff --git a/assets/sass/_theme/design-system/layout.sass b/assets/sass/_theme/design-system/layout.sass
index ef3d7986..832eb646 100644
--- a/assets/sass/_theme/design-system/layout.sass
+++ b/assets/sass/_theme/design-system/layout.sass
@@ -123,27 +123,4 @@ details
                 position: absolute
                 padding: 0
                 right: 0
-                top: 0
-
-.alternate
-    .block:not(.block-projects) &
-        article
-            @include media-breakpoint-up(desktop)
-                &:not(:first-child)
-                    margin-top: -5%
-                &:nth-child(odd)
-                    margin-left: auto
-                &.portrait
-                    + .portrait
-                        margin-top: -30%
-                    + .square,
-                    + .landscape
-                        margin-top: -15%
-                    + article:not(.portrait, .square, .landscape)
-                        margin-top: -5%
-                &.square + .square
-                    margin-top: -10%
-        @include in-page-without-sidebar
-            width: columns(10)
-            margin-left: auto
-            margin-right: auto
\ No newline at end of file
+                top: 0
\ No newline at end of file
diff --git a/assets/sass/_theme/utils/blocks.sass b/assets/sass/_theme/utils/blocks.sass
index 7343e4ae..d95c4283 100644
--- a/assets/sass/_theme/utils/blocks.sass
+++ b/assets/sass/_theme/utils/blocks.sass
@@ -40,4 +40,29 @@
                 @include icon-block(arrow-next, before)
             &:disabled
                 cursor: default
-                opacity: 0.3
\ No newline at end of file
+                opacity: 0.3
+
+@mixin alternate
+    article
+        .media img
+            aspect-ratio: unset
+        @include media-breakpoint-up(desktop)
+            width: columns(4)
+            &:not(:first-child)
+                margin-top: -5%
+            &:nth-child(odd)
+                margin-left: auto
+            &.portrait
+                + .portrait
+                    margin-top: -30%
+                + .square,
+                + .landscape
+                    margin-top: -15%
+                + article:not(.portrait, .square, .landscape)
+                    margin-top: -5%
+            &.square + .square
+                margin-top: -10%
+    @include in-page-without-sidebar
+        width: columns(10)
+        margin-left: auto
+        margin-right: auto
\ No newline at end of file
-- 
GitLab