-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Block API: Add block styles variations API (#7362)
* Block API: Add block styles variation API * Adding some unit tests * Fix unit tests * Fix e2e tests * Update the block switcher UI to show style variations and previews * Always open the block transforms panel and avoid leaking the text-align * Use the same inserterg grid view for block transforms * Fix unit tests * Add style variations e2e test * Use block icon with colors in main block toolbar. Move styles to the relevant scopes. * Adjust padding of block switcher chip to avoid toolbar clipping. * Center preview for block styles. * Use button to ensure valid HTML * Fix lint * Add alternate styles for separator. * Show style variations when the block type doesn't have any block transform * Improve a11y of the style switcher * Add Button block style variants and fix line height. * Polish the visuals a bit. - Stack borders - Vertically center the contents in the previews - Tweak hover/focus styles * Fix tabs/spaces. * Fix keyboard navigation into the styles preview buttons * Polish preview container, fix focus, separator * Adding the is-active className to the block-styles component * Move the styles BlockAPI to the root level (out of the transforms) * Rename CSS class to utilize is-active. Sorry about the typo. * Showing style variation labels * Polish the separator styles - Bug: the body text was not the same gray as the title. This fixes that. - The new Dots separator style is simpler, smaller, better centered, and uses the same color as the text. - The wide separator style is now thinner. * Fix grid items width * Use proper label names for quote styles. * Polish separator styles for frontend - Rename remaining instance of "asterisks" to "dots" - Move default separator style to theme.scss so it can be opted into - Scope default style so it doesn't bleed into dots and wide styles - Refine dots and wide styles to better work on frontend * Add button outline style. * Fix unit tests (Block Switcher without blocks)
- Loading branch information
1 parent
188b679
commit e197ba0
Showing
38 changed files
with
835 additions
and
329 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
|
||
.editor-rich-text__tinymce { | ||
cursor: text; | ||
line-height: 1; | ||
} | ||
} | ||
|
||
|
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
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
font-style: normal; | ||
} | ||
|
||
&.is-large { | ||
&.is-style-large, &.is-large { | ||
margin: 0 0 16px; | ||
padding: 0 1em; | ||
|
||
|
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,6 +1,26 @@ | ||
.wp-block-separator { | ||
border: none; | ||
border-bottom: 2px solid $dark-gray-100; | ||
max-width: 100px; | ||
margin: 1.65em auto; | ||
// Default, thin style, is stored in theme.scss so it can be opted out of | ||
|
||
// Wide style | ||
&.is-style-wide { | ||
border-bottom-width: 1px; | ||
} | ||
|
||
// Dots style | ||
&.is-style-dots { | ||
border: none; | ||
text-align: center; | ||
max-width: none; | ||
line-height: 1; | ||
height: auto; | ||
|
||
&:before { | ||
content: '\00b7 \00b7 \00b7'; | ||
color: $dark-gray-700; | ||
font-size: 20px; | ||
letter-spacing: 2em; | ||
padding-left: 2em; | ||
font-family: serif; | ||
} | ||
} | ||
} |
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,2 +1,10 @@ | ||
// TODO: Remove this comment when adding theme styles. | ||
// Including an empty file for now so webpack will build an aggregate build/core-blocks/theme.css. | ||
.wp-block-separator { | ||
border: none; | ||
border-bottom: 2px solid $dark-gray-100; | ||
margin: 1.65em auto; | ||
|
||
// Default, thin style | ||
&:not( .is-style-wide ):not( .is-style-dots ) { | ||
max-width: 100px; | ||
} | ||
} |
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,3 +1,3 @@ | ||
<!-- wp:core/quote {"style":"1"} --> | ||
<!-- wp:core/quote --> | ||
<blockquote class="wp-block-quote"><p>The editor will endeavour to create a new page and post building experience that makes writing rich posts effortless, and has “blocks” to make it easy what today might take shortcodes, custom HTML, or “mystery meat” embed discovery.</p><cite>Matt Mullenweg, 2017</cite></blockquote> | ||
<!-- /wp:core/quote --> |
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,3 +1,3 @@ | ||
<!-- wp:core/quote {"style":"2"} --> | ||
<blockquote class="wp-block-quote is-large"><p>There is no greater agony than bearing an untold story inside you.</p><cite>Maya Angelou</cite></blockquote> | ||
<!-- wp:core/quote {"className":"is-style-large"} --> | ||
<blockquote class="wp-block-quote is-style-large"><p>There is no greater agony than bearing an untold story inside you.</p><cite>Maya Angelou</cite></blockquote> | ||
<!-- /wp:core/quote --> |
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
Oops, something went wrong.
e197ba0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized a conflict caused by the change in edit-post/components/visual-editor/style.scss. It overrides color style rule from color style classes (
.has-very-dark-gray-background-color
for example).e197ba0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.