From b1a5378cd9dd5675e7da0675bfe2e2499a123253 Mon Sep 17 00:00:00 2001 From: Thomas Guillot Date: Fri, 19 Jul 2024 14:45:22 +0100 Subject: [PATCH] feat: update post-content; adjust align left/right position (#280) --- src/scss/_base.scss | 22 +----------------- src/scss/blocks/_columns.scss | 5 +++++ src/scss/blocks/_post-content.scss | 31 ++++++++++++++++++++++++++ templates/single.html | 2 +- templates/single/50-50-image.html | 2 +- templates/single/full-width-image.html | 2 +- templates/single/large-image.html | 2 +- templates/single/wide-image.html | 2 +- 8 files changed, 42 insertions(+), 26 deletions(-) diff --git a/src/scss/_base.scss b/src/scss/_base.scss index edb57063..30fb8c63 100644 --- a/src/scss/_base.scss +++ b/src/scss/_base.scss @@ -141,27 +141,6 @@ ol { } } -.entry-content { - > :last-child:is(.alignfull):is(.has-background), - > :last-child:is(.alignfull):is(.wp-block-cover) { - margin-bottom: calc(-1 * var(--wp--preset--spacing--80)) !important; - } -} - -.page-template-no-title, -.home.page { - .entry-content { - > :first-child:is(.alignfull):is(.has-background), - > :first-child:is(.alignfull):is(.wp-block-cover) { - margin-top: calc(-1 * var(--wp--preset--spacing--50)) !important; - - @include sass-utils.media(medium) { - margin-top: calc(-1 * var(--wp--preset--spacing--80)) !important; - } - } - } -} - .alignleft, .alignright { margin-block-end: var(--wp--preset--spacing--50); @@ -175,6 +154,7 @@ ol { } } +.is-layout-constrained, .is-layout-flow { > .alignleft { margin-inline-end: var(--wp--preset--spacing--50); diff --git a/src/scss/blocks/_columns.scss b/src/scss/blocks/_columns.scss index 50859809..ec987dd5 100644 --- a/src/scss/blocks/_columns.scss +++ b/src/scss/blocks/_columns.scss @@ -128,6 +128,11 @@ .wp-block-post-content { padding-left: 0; padding-right: 0; + + > .alignfull { + margin-left: 0; + margin-right: 0; + } } } diff --git a/src/scss/blocks/_post-content.scss b/src/scss/blocks/_post-content.scss index 93f0d311..043c3fae 100644 --- a/src/scss/blocks/_post-content.scss +++ b/src/scss/blocks/_post-content.scss @@ -1,8 +1,39 @@ +@use '../sass-utils'; + .wp-block-post-content { + .has-global-padding > &.alignwide { + padding-left: 0; + padding-right: 0; + + > .alignfull { + margin-left: calc(50% - 50vw); + margin-right: calc(50% - 50vw); + } + } + + main:not(:has(.post-footer)) & { + > :last-child:is(.alignfull):is(.has-background), + > :last-child:is(.alignfull):is(.wp-block-cover) { + margin-bottom: calc(-1 * var(--wp--preset--spacing--80)) !important; + } + } + > .alignfull { margin-left: calc(-1 * var(--wp--preset--spacing--30)); margin-right: calc(-1 * var(--wp--preset--spacing--30)); padding-left: var(--wp--preset--spacing--30); padding-right: var(--wp--preset--spacing--30); } + + .page-template-no-title &, + .home.page & { + > :first-child:is(.alignfull):is(.has-background), + > :first-child:is(.alignfull):is(.wp-block-cover) { + margin-top: calc(-1 * var(--wp--preset--spacing--50)) !important; + + @include sass-utils.media(medium) { + margin-top: calc(-1 * var(--wp--preset--spacing--80)) !important; + } + } + } } diff --git a/templates/single.html b/templates/single.html index e76b9fd2..fc0fc76e 100644 --- a/templates/single.html +++ b/templates/single.html @@ -13,7 +13,7 @@
- +
diff --git a/templates/single/50-50-image.html b/templates/single/50-50-image.html index 6e97f5a7..5c41a471 100644 --- a/templates/single/50-50-image.html +++ b/templates/single/50-50-image.html @@ -21,7 +21,7 @@
- +
diff --git a/templates/single/full-width-image.html b/templates/single/full-width-image.html index 91fa3f9e..ac8645fe 100644 --- a/templates/single/full-width-image.html +++ b/templates/single/full-width-image.html @@ -13,7 +13,7 @@
- +
diff --git a/templates/single/large-image.html b/templates/single/large-image.html index f9639c71..26ed5bb9 100644 --- a/templates/single/large-image.html +++ b/templates/single/large-image.html @@ -13,7 +13,7 @@
- +
diff --git a/templates/single/wide-image.html b/templates/single/wide-image.html index 7b8c1320..6715ea8a 100644 --- a/templates/single/wide-image.html +++ b/templates/single/wide-image.html @@ -13,7 +13,7 @@
- +