Skip to content

Commit

Permalink
feat: update post-content; adjust align left/right position (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasguillot authored Jul 19, 2024
1 parent 6e3da20 commit b1a5378
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 26 deletions.
22 changes: 1 addition & 21 deletions src/scss/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -175,6 +154,7 @@ ol {
}
}

.is-layout-constrained,
.is-layout-flow {
> .alignleft {
margin-inline-end: var(--wp--preset--spacing--50);
Expand Down
5 changes: 5 additions & 0 deletions src/scss/blocks/_columns.scss
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@
.wp-block-post-content {
padding-left: 0;
padding-right: 0;

> .alignfull {
margin-left: 0;
margin-right: 0;
}
}
}

Expand Down
31 changes: 31 additions & 0 deletions src/scss/blocks/_post-content.scss
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
}
2 changes: 1 addition & 1 deletion templates/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<!-- wp:group {"lock":{"move":false,"remove":true},"metadata":{"name":"Post Content"},"align":"full","style":{"spacing":{"margin":{"top":"var:preset|spacing|80"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group alignfull" style="margin-top:var(--wp--preset--spacing--80)">
<!-- wp:post-content {"lock":{"move":false,"remove":true},"align":"full","layout":{"type":"constrained"}} /-->
<!-- wp:post-content {"lock":{"move":false,"remove":true},"align":"wide","layout":{"type":"constrained"}} /-->
</div>
<!-- /wp:group -->

Expand Down
2 changes: 1 addition & 1 deletion templates/single/50-50-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<!-- wp:group {"lock":{"move":false,"remove":true},"metadata":{"name":"Post Content"},"align":"full","style":{"spacing":{"margin":{"top":"var:preset|spacing|80"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group alignfull" style="margin-top:var(--wp--preset--spacing--80)">
<!-- wp:post-content {"lock":{"move":false,"remove":true},"align":"full","layout":{"type":"constrained"}} /-->
<!-- wp:post-content {"lock":{"move":false,"remove":true},"align":"wide","layout":{"type":"constrained"}} /-->
</div>
<!-- /wp:group -->

Expand Down
2 changes: 1 addition & 1 deletion templates/single/full-width-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<!-- wp:group {"lock":{"move":false,"remove":true},"metadata":{"name":"Post Content"},"align":"full","style":{"spacing":{"margin":{"top":"var:preset|spacing|80"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group alignfull" style="margin-top:var(--wp--preset--spacing--80)">
<!-- wp:post-content {"lock":{"move":false,"remove":true},"align":"full","layout":{"type":"constrained"}} /-->
<!-- wp:post-content {"lock":{"move":false,"remove":true},"align":"wide","layout":{"type":"constrained"}} /-->
</div>
<!-- /wp:group -->

Expand Down
2 changes: 1 addition & 1 deletion templates/single/large-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<!-- wp:group {"lock":{"move":false,"remove":true},"metadata":{"name":"Post Content"},"align":"full","style":{"spacing":{"margin":{"top":"var:preset|spacing|80"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group alignfull" style="margin-top:var(--wp--preset--spacing--80)">
<!-- wp:post-content {"lock":{"move":false,"remove":true},"align":"full","layout":{"type":"constrained"}} /-->
<!-- wp:post-content {"lock":{"move":false,"remove":true},"align":"wide","layout":{"type":"constrained"}} /-->
</div>
<!-- /wp:group -->

Expand Down
2 changes: 1 addition & 1 deletion templates/single/wide-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<!-- wp:group {"lock":{"move":false,"remove":true},"metadata":{"name":"Post Content"},"align":"full","style":{"spacing":{"margin":{"top":"var:preset|spacing|80"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group alignfull" style="margin-top:var(--wp--preset--spacing--80)">
<!-- wp:post-content {"lock":{"move":false,"remove":true},"align":"full","layout":{"type":"constrained"}} /-->
<!-- wp:post-content {"lock":{"move":false,"remove":true},"align":"wide","layout":{"type":"constrained"}} /-->
</div>
<!-- /wp:group -->

Expand Down

0 comments on commit b1a5378

Please sign in to comment.