Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

Columns Block: Try adding a "negative margins" block style #337

Merged
merged 18 commits into from
Oct 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions assets/css/ie-editor.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/css/ie-editor.css.map

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions assets/css/ie.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/css/ie.css.map

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions assets/css/style-editor.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/css/style-editor.css.map

Large diffs are not rendered by default.

50 changes: 46 additions & 4 deletions assets/sass/05-blocks/columns/_editor.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
.wp-block-columns .wp-block,
.wp-block-columns .wp-block-column {
// Allow Gutenberg to set the width of a block that lives inside the columns block.
max-width: inherit;
.wp-block-columns {

.wp-block,
.wp-block-column {
// Allow Gutenberg to set the width of a block that lives inside the columns block.
max-width: inherit;
}

&.is-style-twentytwentyone-columns-overlap {

@include media(laptop) {

.wp-block-column:nth-child(2n) {
margin-left: calc(-2 * var(--global--spacing-horizontal));
margin-top: calc(2.5 * var(--global--spacing-horizontal));

// Provide text-based child blocks with a default background color to ensure they're readable.
> p,
> h1,
> h2,
> h3,
> h4,
> h5,
> h6,
> ul,
> ol,
> pre {

&:not(.has-background) {
background-color: var(--global--color-background);
padding: var(--global--spacing-unit);
}
}

// Lists should still have their usual left padding.
> ul:not(.has-background),
> ol:not(.has-background) {
padding-left: calc(2 * var(--global--spacing-horizontal));
}

&.is-vertically-aligned-center {
margin-top: 0;
}
}
}
}
}
39 changes: 39 additions & 0 deletions assets/sass/05-blocks/columns/_style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,43 @@
margin-bottom: 0;
}
}

&.is-style-twentytwentyone-columns-overlap {

@include media(laptop) {

.wp-block-column:nth-child(2n) {
margin-left: calc(-2 * var(--global--spacing-horizontal));
margin-top: calc(2.5 * var(--global--spacing-horizontal));

// Provide text-based child blocks with a default background color to ensure they're readable.
> p,
> h1,
> h2,
> h3,
> h4,
> h5,
> h6,
> ul,
> ol,
> pre {

&:not(.has-background) {
background-color: var(--global--color-background);
padding: var(--global--spacing-unit);
}
}

// Lists should still have their usual left padding.
> ul:not(.has-background),
> ol:not(.has-background) {
padding-left: calc(2 * var(--global--spacing-horizontal));
}

&.is-vertically-aligned-center {
margin-top: 0;
}
}
}
}
}
9 changes: 9 additions & 0 deletions inc/block-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
* @return void
*/
function twenty_twenty_one_register_block_styles() {
// Columns: Overlap.
register_block_style(
'core/columns',
array(
'name' => 'twentytwentyone-columns-overlap',
'label' => __( 'Overlap', 'twentytwentyone' ),
)
);

// Cover: Borders.
register_block_style(
'core/cover',
Expand Down
27 changes: 27 additions & 0 deletions style-rtl.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion style.css.map

Large diffs are not rendered by default.