Skip to content

Commit

Permalink
Layout Grid: Fix vertical alignment, round 2 (#254)
Browse files Browse the repository at this point in the history
* Layout Grid: Fix vertical alignment, round 2

* Fix whitespace.
  • Loading branch information
jasmussen authored Dec 17, 2021
1 parent 33e1f9b commit 162dbc1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
16 changes: 9 additions & 7 deletions blocks/layout-grid/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,20 @@
* Visual Glitches
*/

// Make sure each column is full height in the editor, as it is on the frontend.
[data-type="jetpack/layout-grid-column"] > .block-editor-block-list__block-edit,
[data-type="jetpack/layout-grid-column"] > .block-editor-block-list__block-edit > [data-block],
// This prevents collapsing margins, which makes for a more stable experience.
// It is definitely needed for background colors to work.
.wp-block-jetpack-layout-grid-column {
height: 100%;

// This prevents collapsing margins, which makes for a more stable experience.
// It is definitely needed for background colors to work.
border-top: 0.05px solid transparent;
border-bottom: 0.05px solid transparent;
}

// There are extra containers in the editing canvas. They need to be set to grid
// same as the corresponding containers on the frontend, to match.
[data-type="jetpack/layout-grid-column"] {
display: grid;
height: 100%;
}

// When grid is full-wide, pad the inner blocks so the side UI is available, including resize handles.
// To make sure this is smooth, we add some animation.
// For now this whole bit exists so the side UI, and resize handles, are available even on full-wide blocks.
Expand Down
6 changes: 6 additions & 0 deletions blocks/layout-grid/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,11 @@
}
}


/**
* Parent column alignment
*/

.wp-block-jetpack-layout-grid {
&.are-vertically-aligned-top {
align-items: flex-start;
Expand All @@ -182,12 +184,16 @@
}
}


/**
* Individual column alignment
*/

.wp-block-jetpack-layout-grid-column {
// Allow top-aligned columns to span the full height.
&.is-vertically-aligned-top {
align-self: flex-start;
height: 100%;
}

&.is-vertically-aligned-center {
Expand Down

0 comments on commit 162dbc1

Please sign in to comment.