forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Columns Block: Make responsive, make editor and theme match (WordPres…
…s#10541) * Add basic responsiveness. * Refactor columns metrics. Level the playing field in editor and frontend. * Add space between colums. Fixes WordPress#7818. Fixes WordPress#6048. * Remove "beta" designation from columns block. * Columns block: Fix column width when editing * Column block: Improve padding for the first and last item in a row * Tests: Rename Columns block name also in e2e tests
- Loading branch information
Showing
4 changed files
with
128 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,49 @@ | ||
.wp-block-columns { | ||
display: flex; | ||
|
||
// Responsiveness: Allow wrapping on mobile. | ||
flex-wrap: wrap; | ||
|
||
@include break-medium() { | ||
flex-wrap: nowrap; | ||
} | ||
} | ||
|
||
.wp-block-column { | ||
flex: 1; | ||
margin-bottom: 1em; | ||
|
||
// Responsiveness: Show at most one columns on mobile. | ||
flex-basis: 100%; | ||
|
||
// Beyond mobile, allow 2 columns. | ||
@include break-small() { | ||
flex-basis: 50%; | ||
flex-grow: 0; | ||
} | ||
|
||
// Add space between columns. Themes can customize this if they wish to work differently. | ||
// Only apply this beyond the mobile breakpoint, as there's only a single column on mobile. | ||
@include break-small() { | ||
padding-left: $grid-size-large; | ||
padding-right: $grid-size-large; | ||
|
||
&:nth-child(odd) { | ||
padding-left: 0; | ||
} | ||
|
||
&:nth-child(even) { | ||
padding-right: 0; | ||
} | ||
} | ||
|
||
@include break-medium() { | ||
&:not(:first-child) { | ||
padding-left: $grid-size-large; | ||
} | ||
|
||
&:not(:last-child) { | ||
padding-right: $grid-size-large; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters